Style borderTopWidth Property
Example
Change the width of the top border of a <div> element to 10px:
document.getElementById("myDiv").style.borderTopWidth = "10px";
Try it Yourself »
Description
The borderTopWidth property sets or returns the width of the top border of an element.
Browser Support
Property | |||||
---|---|---|---|---|---|
borderTopWidth | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the borderTopWidth property:
object.style.borderTopWidth
Set the borderTopWidth property:
object.style.borderTopWidth = "thin|medium|thick|length|initial|inherit"
Property Values
Value | Description |
---|---|
thin | Defines a thin border |
medium | Defines a medium border. This is default |
thick | Defines a thick border |
length | The width of the border in length units |
inherit | The width of the top border is inherited from the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technical Details
Default Value: | medium |
---|---|
Return Value: | A String, representing the width of an element's top border |
CSS Version | CSS1 |
More Examples
Example
Change the width of the top border of a <div> element to thin:
document.getElementById("myDiv").style.borderTopWidth = "thin";
Try it Yourself »
Example
Return the width of the top border of a <div> element:
alert(document.getElementById("myDiv").style.borderTopWidth);
Try it Yourself »
Related Pages
CSS tutorial: CSS Border
CSS reference: border-top-width property
HTML DOM reference: border property
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.