Style borderTop Property
- Previous Page borderStyle
- Next Page borderTopColor
- Go Back to Previous Level HTML DOM Style Object
Definition and Usage
borderTop
Properties set or returned in shorthand form to a maximum of three separate border-top properties.
Through this property, you can set/return the following one or more (in any order):
See Also:
CSS Tutorial:CSS Border
CSS Reference Manual:border-top Property
HTML DOM Reference Manual:border Property
Example
Example 1
Add a top border to the <div> element:
document.getElementById("myDiv").style.borderTop = "thick solid #0000FF";
Example 2
Change the width, style, and color of the border-top of the <div> element:
document.getElementById("myDiv").style.borderTop = "thin dotted red";
Example 3
Return the border-top property value of the <div> element:
alert(document.getElementById("myDiv").style.borderTop);
Syntax
Return the borderTop property:
object.style.borderTop
Set the borderTop property:
object.style.borderTop = "width style color|initial|inherit"
Property Value
Value | Description |
---|---|
width | Set the width of the top border. |
style | Set the style of the top border. |
color | Set the color of the top border. |
initial | Set this property to its default value. See initial. |
inherit | Inherit this property from its parent element. See inherit. |
Technical Details
Default Value: | Not Specified |
---|---|
Return Value: | A string representing the width, style, and/or color of the element's top border. |
CSS Version: | CSS1 |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page borderStyle
- Next Page borderTopColor
- Go Back to Previous Level HTML DOM Style Object