Srinivas Gorla has Published 75 Articles

How to center text in HTML?

Srinivas Gorla

Srinivas Gorla

Updated on 31-Aug-2023 01:55:04

132K+ Views

The text in an HTML document can be horizontally centred by using the HTML tag. Since HTML5 did away with this tag, it is advised that you format the document's text horizontally instead by using the CSS text-align property. The element is another name for this tag. ... Read More

CSS3 HSL color property

Srinivas Gorla

Srinivas Gorla

Updated on 29-Jun-2020 10:14:27

157 Views

HSL stands for hue, saturation, lightness. Here, Huge is a degree of the color wheel, saturation and lightness are percentage values between 0 to 100%. ExampleThe following example shows HSL color property:Live Demo                    #g1 {background-color:hsl(120, 100%, 50%);}          #g2 {background-color:hsl(120,100%,75%);}          #g3 {background-color:hsl(120,100%,25%);}                     HSL colors:       Green       Normal Green       Dark Green    

Working with CSS Units

Srinivas Gorla

Srinivas Gorla

Updated on 29-Jun-2020 08:33:21

140 Views

CSS has several units for different units such as width, margin, padding, font-size, border-width, etc. The length indicates by using numerical value followed by length units such as px, dp, em, etc. It does not allow white spaces in between numerical values and length units.Length units divided as follows:relative unitsabsoluteAbsolute ... Read More

What is the easiest code for array intersection in JavaScript?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 13:03:41

71 Views

For array intersection, you can try to run the following code in JavaScript −Example                    let intersection = function(x, y) {             x = new Set(x), y = new Set(y);             return [...x].filter(k => y.has(k));          };          document.write(intersection([5,7,4,8], [3,9,8,4,3]));          

How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 12:33:48

71 Views

Use the orphans property in JavaScript to set the minimum number of lines for an element that should be left at the bottom of a page when a page break occurs inside an element with JavaScript.You can return the orphans property like this −var res = object.style.orphansSet the orphans property ... Read More

Create a syntax highlighting code with JavaScript.

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 12:00:35

102 Views

To create a syntax-highlighting code with JavaScript, use the prettify library. Add the following in your code to add the library for syntax highlighting −To use it, add the following to your tag −    Code comes here

How to set the horizontal alignment of text with JavaScript?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 11:28:55

618 Views

Use the textAlign property in JavaScript and set it to right for aligning it horizontally. You can try to run the following code to return the horizontal alignment of text with JavaScript −Example           This is demo text       Set Horizontal Alignment                function display() {             document.getElementById("myText").style.textAlign = "right";          }          

What are the methods supported by W3C DOM?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 08:12:46

53 Views

The following are the method supported by W3C DOM −Sr.NoProperty & Description1createAttribute( name)Returns a newly-created Attr node with the specified name.Ex − document.createAttribute( name)2createComment( text)Creates and returns a new Comment node containing the specified text.Ex − document.createComment( text)3createDocumentFragment( )Creates and returns an empty DocumentFragment node.Ex − document.createDocumentFragment( )4createElement( tagName)Creates and ... Read More

How can I access document properties using Legacy DOM method in JavaScript?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 07:24:34

89 Views

To access document properties using Legacy DOM method in JavaScript, you can try to run the following code −Example           Document Title                                     This is main title       Click the following to see the result:                                                        

What is the role of clearTimeout() function in JavaScript?

Srinivas Gorla

Srinivas Gorla

Updated on 23-Jun-2020 06:55:51

187 Views

If you have set a time using setTimeout() function, then you can clear it using the JavaScript clearTimeout() function.ExampleYou can try to run the following code learn how to implement clearTimeout() function in JavaScript −           JavaScript Animation                                                        Click the buttons below to handle animation                              

1 2 3 4 5 ... 8 Next
Advertisements