Srinivas Gorla has Published 84 Articles

How to center text in HTML?

Srinivas Gorla

Srinivas Gorla

Updated on 05-Sep-2022 12:42:32

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

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

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

Set the border image width with CSS

Srinivas Gorla

Srinivas Gorla

Updated on 29-Jun-2020 08:06:34

The border-image-width property is used to set the border image width with CSS.ExampleYou can try to run the following code to implement the border-image-width property −Live Demo                    #borderimg1 {             border: 15px solid transparent;   ... Read More

What is the easiest code for array intersection in JavaScript?

Srinivas Gorla

Srinivas Gorla

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

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

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

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

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

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

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:                                                        

1 2 3 4 5 ... 9 Next
Advertisements