Javascript examples for CSS Style Property:border
The border property sets or gets three separate border properties:
Parameter | Description |
---|---|
width | Sets the width of the borders |
style | Sets the style of the borders |
color | Sets the color of the borders |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | not specified |
Return Value: | A String, representing the border width, style and/or color |
CSS Version | CSS1 |
Get a border 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()">Test</button> <script> function myFunction() {//from w w w . j av a 2 s .c o m console.log(document.getElementById("myDiv").style.borderWidth); } </script> </body> </html>