Change the width of the four borders of a <div> element:
The borderWidth property sets or returns the width of an element's border.
This property can take from one to four values:
The borderWidth property is supported in all major browsers.
Return the borderWidth property:
Set the borderWidth property:
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 |
Default Value: | medium |
---|---|
Return Value: | A String, representing the width of an element's border |
CSS Version | CSS1 |
Change the width of the top and bottom border to thick, and the left and right border to thin of a <div> element:
Change the width of the four borders of a <div> element, using the length value:
Return the width of the border of a <div> element:
CSS tutorial: CSS Border
CSS reference: border-width property
HTML DOM reference: border property