Javascript Articles

Page 7 of 534

How to set all the border top properties in one declaration with JavaScript?

Monica Mona
Monica Mona
Updated on 11-Mar-2026 304 Views

To set all the border top properties in a single declaration, use the borderTop property. With this property, you can set the border-top-width, border-top-style, and border-top-color property.ExampleYou can try to run the following code to learn how to work with border-top properties in JavaScript −                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top border                function display() {             document.getElementById("box").style.borderTop = "thick solid #000000";          }          

Read More

How to set the width of an element's border with JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 1K+ Views

To set the width of an element’s border in JavaScript, use the borderWidth property. Set the width using this property. You can try to run the following code to learn how to set the width of an element’s border − Example Live Demo #box { border: thick solid gray; width: 300px; height: 200px } Demo Text Change border width function display() { document.getElementById("box").style.borderWidth = "thin"; }

Read More

Set whether or not an element should be visible while not facing the screen with JavaScript?

Monica Mona
Monica Mona
Updated on 11-Mar-2026 246 Views

Use the JavaScript backfaceVisibility property to set whether or not an element should be visible while not facing the screen.ExampleYou can try to run the following code to learn how to implement a backfaceVisibility property in JavaScript −                    div {             width: 200px;             height: 300px;             background: blue;             color: black;             animation: mymove 2s infinite linear alternate;          }          @keyframes mymove {             to {transform: rotateY(180deg);}          }                     Check below to display backface                Demo             backfaceVisibility Property                function display(x) {             if (x.checked === true) {                document.getElementById("box").style.backfaceVisibility = "visible";             } else {                document.getElementById("box").style.backfaceVisibility = "hidden";             }          }          

Read More

How to set outline color with JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 564 Views

To set outline color, use the outlineColor property in JavaScript. You can try to run the following code to learn how to implement outlineColor property − Example Live Demo #box { border: 2px solid red; } Demo Content Change outline color function display() { document.getElementById("box").style.outlineColor = "#FF5733"; document.getElementById("box").style.outline = "2px solid"; }

Read More

How to set an element's display type with JavaScript?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 2K+ Views

To set an element’s display type, use the display property. If you want to hide the element, then use none.ExampleYou can try to run the following code to set an element's display type with JavaScript −                    #myID {             width: 250px;             height: 200px;             background-color: green;          }                     Set display as none                Heading Level 1 for Demo          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.                      function display() {             document.getElementById("myID").style.display = "none";          }          

Read More

How to set listStyleImage, listStylePosition, and listStyleType in one declaration with JavaScript?

Sharon Christine
Sharon Christine
Updated on 11-Mar-2026 142 Views

To set the list properties in a single declaration, use the listStyle property in JavaScript.ExampleYou can try to run the following code to set the listStylePosition and listStyleType property in one declaration with JavaScript −                    One          Two             Change style                function display() {             document.getElementById("myID").style.listStyle = "circle outside";          }          

Read More

How to set the maximum height of an element with JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 795 Views

Use the maxHeight property in JavaScript to set the maximum height. You can try to run the following code to set the maximum height of an element with JavaScript −Example    #box {       width: 300px;       background-color: gray;       overflow: auto;    } Click below to set Maximum height. Max Height This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is a div. This is a ...

Read More

How to set the list-item marker type with JavaScript?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 525 Views

To set the type of the list-item marker type, use the listStyleType property. The marker type can be square, circle, dic, etc.ExampleYou can try to run the following code to set the list-item marker type with JavaScript −                    One          Two             Update list style type (square)       Update list style type (decimal)                function displaySquare() {             document.getElementById("myID").style.listStyleType = "square";          }          function displayDecimal() {             document.getElementById("myID").style.listStyleType = "decimal";          }          

Read More

How to offset an outline and draw it beyond the border edge with JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 249 Views

To offset an outline, use the outlineOffsetproperty. It allows you to draw the outline beyond the border edge. You can try to run the following code to offset an outline and draw it beyond the border edge with JavaScript. Example #box { width: 450px; background-color: orange; ...

Read More

How to set the style of the outline around an element with JavaScript?

Arushi
Arushi
Updated on 11-Mar-2026 300 Views

To set the outline style, use the outlineStyle property. The outline can be solid, dotted, dashed, etc.ExampleYou can try to run the following code to set the style of the outline around an element with JavaScript −                    #box {             width: 450px;             background-color: orange;             border: 3px solid red;             margin-left: 20px;          }                     ...

Read More
Showing 61–70 of 5,339 articles
« Prev 1 5 6 7 8 9 534 Next »
Advertisements