Example
Change the width of the left border of a <div> element to 10px:
document.getElementById("myDiv").style.borderLeftWidth = "10px";
Try it Yourself »
Definition and Usage
The borderLeftWidth property sets or returns the width of the left border of an element.
Browser Support
The borderLeftWidth property is supported in all major browsers.
Syntax
Return the borderLeftWidth property:
object.style.borderLeftWidth
Set the borderLeftWidth property:
object.style.borderLeftWidth="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 |
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 left border |
CSS Version | CSS1 |
More Examples
Example
Change the width of the left border of a <div> element to thin:
document.getElementById("myDiv").style.borderLeftWidth = "thin";
Try it Yourself »
Example
Return the width of the left border of a <div> element:
alert(document.getElementById("myDiv").style.borderLeftWidth);
Try it Yourself »
Related Pages
CSS tutorial: CSS Border
CSS reference: border-left-width property
HTML DOM reference: border property
< Style Object