border-top-width CSS propertyThe border-top-width CSS property sets the width of the top border of an element.
border-top-width: thick;border-top-width: 2em;border-top-width: 4px;border-top-width: 2ex;border-top-width: 0;<section class="default-example" id="default-example">
<div class="transition-all" id="example-element">
This is a box with a border around it.
</div>
</section>#example-element {
background-color: palegreen;
color: black;
border: 0 solid crimson;
padding: 0.75em;
width: 80%;
height: 100px;
}/* Keyword values */
border-top-width: thin;
border-top-width: medium;
border-top-width: thick;
/* <length> values */
border-top-width: 10em;
border-top-width: 3vmax;
border-top-width: 6px;
/* Global keywords */
border-top-width: inherit;
border-top-width: initial;
border-top-width: revert;
border-top-width: revert-layer;
border-top-width: unset;<line-width>Defines the width of the border, either as an explicit non-negative <length> or the keywords: thin, medium, or thick. The default is medium.
| Initial value | medium |
|---|---|
| Applies to | all elements. It also applies to ::first-letter. |
| Inherited | no |
| Computed value | the absolute <length>, snapped as a line width |
| Animation type | a length |
border-top-width =
<line-width>
<line-width> =
<length [0,∞]> |
hairline |
thin |
medium |
thick
<div>Element 1</div>
<div>Element 2</div>div {
border: 1px solid red;
margin: 1em 0;
}
div:nth-child(1) {
border-top-width: thick;
}
div:nth-child(2) {
border-top-width: 2em;
}border-left-width, border-right-width, border-bottom-width, and border-width.border, border-top, border-top-style, and border-top-color.