Found 9054 Articles for Front End Technology

How to set the shadow effect of a text with JavaScript?

Sravani S
Updated on 23-Jun-2020 11:23:38

746 Views

To set the shadow effect, use the textShadow property in JavaScript.ExampleYou can try to run the following code to return the shadow effect of a text with JavaScript −           Set Text Shadow                This is Demo Text! This is Demo Text! This is This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text! This is Demo Text!                      function display() {             document.getElementById("myID").style.textShadow = "2px 2px 2px #ff0000,20px 5px 2px #F1F1F1";          }          

What is to be done when text overflows the containing element with JavaScript?

Krantik Chavan
Updated on 23-Jun-2020 11:36:08

44 Views

Use the textOverflow property to counter the text overflow issue. Add ellipses if the text overflows the containing element.ExampleYou can try to run the following code to learn what is to be done when text overflows the containing element with JavaScript −                    #myID {             border: 2px solid blue;             background-color: gray;             overflow: hidden;             text-overflow: visible;             width: 200px;       ... Read More

How to set the indentation of the first line of text with JavaScript?

Shubham Vora
Updated on 15-Nov-2022 07:56:26

1K+ Views

In this tutorial, we will learn how to set the indentation of the first line of text with JavaScript. The indentation of the first line of a text is a common way to start a new paragraph. To set the indentation, use the textIndent property. To set the indentation of the first line of text with JavaScript, we will discuss two different ways − Using the style.textIndent Property Using the style.setProperty Method Using the style.textIndent Property The style.textIndent property of an element is used to set the indentation of the first line of text. This property is placed ... Read More

How to set the style of the line in a text decoration with JavaScript?

Shubham Vora
Updated on 22-Nov-2022 07:37:42

909 Views

In this tutorial, we shall learn to set the style of the line in a text decoration with JavaScript. To set the style of the line in JavaScript, use the textDecorationStyle property. You can set underline, double, or overline, etc. for the line style. Let us discuss our topic in brief. Using the Style textDecorationStyle Property We can set or return the line style in a text decoration with this property. The major browsers support this property. Firefox adds support with an alternate property named MozTextDecorationStyle. Syntax Following is the syntax to set the style of the line in ... Read More

How to set the bottom position of 3D elements with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 11:32:52

152 Views

In this tutorial, we will learn how to set the bottom position of 3D elements with JavaScript. In a web page, handling a 3D element can be tricky. Using JavaScript, we had to set the top, bottom, sides, etc. To set the bottom position of 3D elements, we use the perspectiveOrigin property of an element’s style object. Using style.perspectiveOrigin Property In JavaScript, the style.perspectiveOrigin property is used to set the bottom position or base position of a 3D element. Firstly, we get the element object using the document.getElementById() method and then set the style.perspectiveOrigin property. ... Read More

How to set the type of line in a text-decoration with JavaScript?

Jennifer Nicholas
Updated on 23-Jun-2020 11:26:01

84 Views

To set the type of line in text-decoration, use the textDecorationLine property. You can try to run the following code to return the type of line in a text-decoration with JavaScript −Example                    This is demo text.                   Set Text Decoration                function display() {             document.getElementById("myText").style.textDecorationColor = "red";             document.getElementById("myText").style.textDecorationLine = "overline";          }          

How to set the top padding of an element with JavaScript?

Priya Pallavi
Updated on 23-Jun-2020 11:26:36

361 Views

Use the paddingTop property in JavaScript to set the top padding. You can try to run the following code to set the top padding of an element with JavaScript −Example                    #box {             border: 2px solid #FF0000;             width: 150px;             height: 70px;          }                     This is demo text.             Top Padding                      function display() {             document.getElementById("box").style.paddingTop = "20px";          }          

How to set the color of the text-decoration with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 11:26:20

708 Views

In this tutorial, we will learn how to set the color of the text-decoration with JavaScript. The text-decoration is a CSS property used to decorate text lines. We can decorate a line using underline, overline, line-through, or none. To set the color of the text-decoration with JavaScript, we have multiple ways, and in this tutorial, we will discuss two of them − Using the style.textDecorationColor Property Using the style.setProperty Method Using the style.textDecorationColor Property In JavaScript, the style.textDecorationColor property of an element is used to set the color of the text-decoration of an element. Any color can be ... Read More

How to set the decoration of a text with JavaScript?

Nikitha N
Updated on 23-Jun-2020 11:27:38

641 Views

Use the textDecoration property in JavaScript to decorate the text. You can underline a text using this property.ExampleYou can try to run the following code to set the decoration of a text with JavaScript −           This is demo text.       Set Text Decoration                function display() {             document.getElementById("myText").style.textDecoration = "underline";          }          

How to set how the last line of a block or a line right before a forced line break is aligned when text-align is "justify" with JavaScript?

Smita Kapse
Updated on 23-Jun-2020 11:28:24

293 Views

Use the textAlignLast property in JavaScript to set the last line to right. Set it to right and allow the right alignment.ExampleYou can try to run the following code to return how the last line of a block or a line right before a forced line break is aligned when text-align is "justify" with JavaScript −                    #myDIV {             text-align: justify;          }                              This is ... Read More

Advertisements