Definition and Usage
The border-top-width CSS property sets the width of the top border of a box.
- Initialmedium
- Applies toall elements
- Inheritedno
- Mediavisual
- Computed Valuethe absolute length or 0 if border-top-style is none or hidden
- Animatableyes, as a length
- Canonical orderthe unique non-ambiguous order defined by the formal grammar
Syntax
Formal syntax: <br-width>
border-top-width: 10em /* Any <length> value */
border-top-width: 3vmax
border-top-width: 6px
border-top-width: thin /* A keyword */
border-top-width: medium
border-top-width: thick
border-top-width: inherit
Values
- <br-width>
- Is either a non-negative explicit <length> value or a keyword denoting the thickness of the bottom border. The keyword must be one of the following values:
Style |
Preview |
Description |
thin |
|
A thin border |
medium |
|
A medium border |
thick |
|
A thick border |
The specification doesn’t precisely define the thickness of each of the keywords, which is therefore implementation specific. Nevertheless, it requests that the thickness does follow the thin ≤ medium ≤ thick inequality and that the values are constant on a single document.
- inherit
- Represents the calculated value of the border-top-width of the parent’s element.
Examples
2 |
border-top-width : thin ; |
3 |
border-top-style : solid ; |
4 |
border-top-color : #000 ; |
2 |
border-top : thick solid red ; |
5 |
border-top : medium solid orange; |
8 |
border-top : thin solid green ; |
Live Sample
Element 1
Element 2
Element 3
Compatibility
Desktop browsers
Feature |
Chrome |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari (WebKit) |
Basic support |
1.0 |
1.0 (1.0) |
4.0 |
3.5 |
1.0 (85) |
Mobile browsers
Feature |
Android |
Firefox Mobile (Gecko) |
IE Phone |
Opera Mobile |
Safari Mobile |
Basic support |
NA |
NA |
NA |
NA |
NA |