Javascript examples for CSS Style Property:borderTop
The borderTop property sets or gets border-top properties in a shorthand form:
Parameter | Description |
---|---|
width | Sets the width of the top border |
style | Sets the style of the top border |
color | Sets the color of the top border |
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 width, style and/or color of the top border of an element |
CSS Version | CSS1 |
Get a top border of a <div> element:
<!DOCTYPE html> <html> <body> <div id="myDiv" style="border-top:thick solid red">This is a div element.</div> <br> <button type="button" onclick="myFunction()">Return the width of the top border</button> <script> function myFunction() {// www. jav a 2 s.c o m console.log(document.getElementById("myDiv").style.borderTopWidth); } </script> </body> </html>