border-top-width
Specifies the width of the top border.
Sample Code
style.css
/* thin keyword (generally 1px) */
div.test { border-top-width: thin;}
/* medium keyword (default, generally 3px) */
div.test1 { border-top-width: medium;}
/* thick keyword (generally 5px) */
div.test2 { border-top-width: thick;}
/* Exact pixel value */
div.test3 { border-top-width: 10px;}
/* Hide the border */
div.test4 { border-top-width: 0;}
/* border-top-style must also be set to make it visible */
.top-border {
border-top-style: solid;
border-top-width: 5px;
border-top-color: #0077cc;
}
Available Values
| Value | Description |
|---|---|
| Number | Specifies the border width in units such as 'px'. |
| thin | The keyword 'thin'. Typically rendered as 1px, though it may vary slightly by browser. |
| medium | The keyword 'medium'. Typically rendered as 3px, though it may vary slightly by browser. This is the initial value when no 'border-top-width' is specified. |
| thick | The keyword 'thick'. Typically rendered as 5px, though it may vary slightly by browser. |
Browser Preview
※ The samples below have 'border-style' set to 'solid'.
<div style="border-top-width: 10px; border-style: solid; height: 100px; padding: 10px; font-weight: bold;">A div element with height 100px and padding 10px.</div>
Browser Support
Desktop
8 ○
7 ○
6 ○
2 and earlier ×Mobile
Android Browser
2.2+ ○
1 and earlier ×Same support as desktop
Same support as desktop
※ Version data based on MDN.
If you find any errors or copyright issues, please contact us.