Style borderTopWidth Property
- Previous Page borderTopStyle
- Next Page borderWidth
- Go to the Previous Level HTML DOM Style Object
Definition and Usage
borderTopWidth
Sets or returns the width of the element's border.
See Also:
CSS Tutorial:CSS Borders
CSS Reference Manual:border-top-width Property
HTML DOM Reference Manual:border Property
Example
Example 1
Changes the top border width of the <div> element to 10px:
document.getElementById("myDiv").style.borderTopWidth = "10px";
Example 2
Changes the top border width of the <div> element to thin:
document.getElementById("myDiv").style.borderTopWidth = "thin";
Example 3
Returns the width of the top border of the <div> element:
alert(document.getElementById("myDiv").style.borderTopWidth);
Syntax
Returns the borderTopWidth property:
object.style.borderTopWidth
Sets the borderTopWidth property:
object.style.borderTopWidth = "thin|medium|thick|length|initial|inherit"
Value | Description |
---|---|
thin | Defines thin borders. |
medium | Defines medium borders. Default. |
thick | Defines thick borders. |
length | Border width measured in length. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical Details
Default Value: | medium |
---|---|
Return Value: | A string representing the width 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 borderTopStyle
- Next Page borderWidth
- Go to the Previous Level HTML DOM Style Object