CSS border-top-width
The CSS border-top-width property allows you to set the width of a top border.
You can also use border-width to set the width for all sides of your element, or border-top to set all border properties for the top border.
The default width for borders is medium.
If you use a border without specifying its color, it will use the currentColor value (which is the value of the color property).
The border's style needs to be specified before it can be displayed. You can use either border-top-style or border-style to specify the border's style.
Syntax
Where
These values are explained below.
Possible Values
thin- Specifies a thin border. It is up to the user agent to determine the actual width.
medium- Specifies a medium width border. It is up to the user agent to determine the actual width.
thick- Specifies a thick border. It is up to the user agent to determine the actual width.
- length
- Specifies the width of the border using a length value. For example,
10px,1em,8ptetc
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
initial- Represents the value specified as the property's initial value.
inherit- Represents the computed value of the property on the element's parent.
unset- This value acts as either
inheritorinitial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.
General Information
- Initial Value
medium- Applies To
- All elements.
- Inherited?
- No
- Media
- Visual
- Animatable
- Yes (see example)
Example Code
Official Specifications
- CSS Backgrounds and Borders Module Level 3 (W3C Candidate Recommendation 9 September 2014)
- CSS Level 2.1 (W3C Recommendation 07 June 2011)
- CSS Level 1 (W3C Recommendation 17 Dec 1996)