Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Javascript Articles
Page 7 of 534
How to set all the border top properties in one declaration with JavaScript?
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 MoreHow to set the width of an element's border with JavaScript?
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 MoreSet whether or not an element should be visible while not facing the screen with JavaScript?
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 MoreHow to set outline color with JavaScript?
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 MoreHow to set an element's display type with JavaScript?
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 MoreHow to set listStyleImage, listStylePosition, and listStyleType in one declaration with JavaScript?
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 MoreHow to set the maximum height of an element with JavaScript?
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 MoreHow to set the list-item marker type with JavaScript?
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 MoreHow to offset an outline and draw it beyond the border edge with JavaScript?
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 MoreHow to set the style of the outline around an element with JavaScript?
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