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
If you use a border without specifying its color, it will use the
currentColor value (which is the value of the
The border's style needs to be specified before it can be displayed. You can use either
border-style to specify the border's style.
These values are explained below.
- Specifies a thin border. It is up to the user agent to determine the actual width.
- Specifies a medium width border. It is up to the user agent to determine the actual width.
- Specifies a thick border. It is up to the user agent to determine the actual width.
- Specifies the width of the border using a length value. For example,
In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:
- Represents the value specified as the property's initial value.
- Represents the computed value of the property on the element's parent.
- This value acts as either
initial, 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.
- Initial Value
- Applies To
- All elements.
- Yes (see example)
- 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)