Javascript examples for CSS Style Property:borderWidth
The borderWidth property sets or gets the width of an element's border.
This property can take from one to four values:
Value | Description |
---|---|
thin | a thin border |
medium | a medium border. This is default |
thick | a thick border |
length | width of the border in length units |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | medium? |
Return Value: | A String, representing the width of an element's border |
CSS Version | CSS1 |
Get the width of the four borders of a <div> element:
<!DOCTYPE html> <html> <body> <div id="myDiv" style="border:1px solid black">This is a div element.</div> <br> <button type="button" onclick="myFunction()">Return the width of the border</button> <script> function myFunction() {/* ww w.j a va 2 s . c om*/ console.log(document.getElementById("myDiv").style.borderWidth); } </script> </body> </html>