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