Found 9054 Articles for Front End Technology

How to handle tabs, line breaks and whitespace in a text in JavaScript?

Shubham Vora
Updated on 15-Sep-2022 12:08:54

1K+ Views

In this tutorial, we will learn how to handle tabs, line breaks, and whitespace in a text in JavaScript. To handle tabs, line breaks, and whitespace in text in JavaScript, we can use the whiteSpace property. This property has seven attributes − normal nowrap pre pre-line pre-wrap initial inherit Generally, in HTML we use the   entity for multiple spaces and the tag to get line break. But in JavaScript, we use different attribute properties (mainly the normal and pre) of white-space properties to handle the tabs, line breaks, and multiple whitespaces. The details of these two ... Read More

How to set whether the text should be overridden to support multiple languages in the same document with JavaScript?

Shubham Vora
Updated on 11-Nov-2022 13:17:02

219 Views

In this tutorial, we will learn how to set whether the text should be overridden to support multiple languages in the same document with JavaScript. Use the unicodeBidi property in JavaScript to set whether the text should be overridden to support multiple languages in the same document. Set it to normal, embed, or bidi-override. The bidi-override allows you to add the direction, i.e., rtl to ltr. Using the unicodeBidi Property In JavaScript, the unicodeBidi property is used along with the direction property to set whether the text should be overridden to support multiple languages in the same document. This property ... Read More

Set how many seconds or milliseconds a transition effect takes to complete.

Nikitha N
Updated on 23-Jun-2020 11:40:15

99 Views

To set the duration for an effect to complete, use the transitionDuration property in JavaScript.ExampleYou can try to run the following code to return how many seconds or milliseconds a transition effect takes to complete −                    #div1 {             position: relative;             margin: 10px;             height: 300px;             width: 400px;             padding: 20px;             border: 2px solid blue;          }          #div2 {             padding: 80px;             position: absolute;             border: 2px solid BLUE;             background-color: yellow;             transform: rotateY(45deg);             transition: all 5s;          }          #div2:hover {             background-color: orange;             width: 50px;             height: 50px;             padding: 100px;             border-radius: 50px;          }                     Hover over DIV2       Set       DIV1          DIV2                      function display() {             document.getElementById("myDIV").style.transitionDuration = "5s";          }          

How to set the CSS property that the transition effect is for with JavaScript?

Nitya Raut
Updated on 23-Jun-2020 11:30:59

77 Views

Use the transitionProperty in JavaScript to set the CSS property. You can try to run the following code to return the CSS property that the transition effect is for with JavaScript −Example                    #div1 {             position: relative;             margin: 10px;             height: 300px;             width: 400px;             padding: 20px;             border: 2px solid blue;          }          #div2 {             padding: 80px;             position: absolute;             border: 2px solid BLUE;             background-color: yellow;             transform: rotateY(45deg);             transition: all 3s;          }          #div2:hover {             background-color: orange;             width: 50px;             height: 50px;             padding: 100px;             border-radius: 50px;          }                     Hover over DIV2       Set       DIV1          DIV2                      function display() {             document.getElementById("div2").style.transitionProperty = "width,height";          }          

How to set the four transition properties with JavaScript?

Shubham Vora
Updated on 11-Nov-2022 13:06:18

4K+ Views

In this tutorial, we will learn how to set the four transition properties with JavaScript. The transition is a CSS property used to set the transition effect of an element. It is a shorthand property for the following: transitionProperty, transitionDuration, transitionTimingFunction, and transitionDelay. The transitionProperty is used to specify the CSS property name that should have the transition effect. The transitionDuration property is used to specify the total time to complete the transition. The transitionTimingFunction is used to specify the speed curve of the transition. The transitionDelay is used to specify after how much time the transition will start. To ... Read More

How nested elements are rendered in 3D space with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 10:49:13

108 Views

This tutorial will teach how the nested elements are rendered in 3D space with JavaScript. You may use the transform property to skew, scale, translate, or rotate an element. It alters the visual formatting model's coordinate space. The transform property can take the keyword value none or one or more transform function values. For several function values, rotate must be mentioned first. Because with the in-order (left to right) multiplication in the transform functions, composite transforms can be applied in the opposite direction, i.e., right to the left. The nested elements are rendered in 3D space using the HTML DOM ... Read More

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

Shubham Vora
Updated on 22-Nov-2022 07:19:15

773 Views

In this tutorial, we will learn how to set the right padding of an element with JavaScript. First, let's try to understand what padding means; padding is simply an extra space between a page's border and our content. The gap between them increases as the value of padding increases. Padding is similar to the margin; padding is distinct from the margin because padding adds space between the border and content, whereas margin is used to add space around the edge. While padding can be done on all sides, i.e., Top, Bottom, Left, and Right in the following lines, we will ... Read More

How to set the vertical alignment of the content in an element with JavaScript?

Shubham Vora
Updated on 09-Nov-2022 10:55:48

635 Views

In this tutorial, we will learn how to set the vertical alignment of the content in an element in JavaScript. The vertical-align property of HTML DOM Style is used to set the vertical alignment of the content in an element. The vertical-align attribute specifies or returns the vertical alignment of an element's content. The vertical-align attribute controls the vertical alignment of an inline-block or table-cell box. The vertical-align attribute is used to align the box of an inline element within its line box vertically. It may, for example, be used to arrange a picture within a line of text vertically. ... Read More

How to set whether the text of an element can be selected or not with JavaScript?

Shubham Vora
Updated on 12-Oct-2022 11:23:04

133 Views

In this tutorial, we will learn to set whether the text of an element can be selected or not with JavaScript. Use the userSelect property in JavaScript to enable or disable a text selection. For Firefox, use the MozUserSelect property and set it to none, to disable the selection. The CSS user-select property can set the text on a web page as selectable or nonselectable. But, sometimes, we must restrict the selection to a triggered event or a condition. Then, we can use the JavaScript DOM that provides nearly all CSS properties. So, let us look ... Read More

How to set the capitalization of a text with JavaScript?

Ramu Prasad
Updated on 23-Jun-2020 11:35:30

127 Views

To set the capitalization, use the textTransform property in JavaScript. Set it to capitalize, if you want the first letter of every word to be a capital letter.ExampleYou can try to run the following code to return the capitalization of a text with JavaScript −           Capitalize Text                This is demo text! This is demo text!                      function display() {             document.getElementById("myID").style.textTransform = "capitalize";          }          

Advertisements