The border-top-width property sets the thickness of an element’s top border. Use a keyword (thin, medium, thick) or a length such as 2px or 0.25rem.
It applies to all elements, including ::first-letter, and it is not inherited. The initial value is medium. A width does nothing useful until border-top-style is a visible style such as solid. For width, style, and color together, prefer the border-top shorthand.
Standard-track.
Not deprecated. Keywords and length values are Baseline and widely available. The newer hairline keyword from CSS Borders Level 4 is still experimental and not safe as a sole value in production yet.
With the default content-box sizing, a thicker top border makes the element taller. box-sizing: border-box keeps the outer size stable.
hairline
hairline is experimental
The Level 4 hairline keyword means a just-visible line. Support is incomplete, so prefer 1px or thin for production.
Compatibility
Browser Support
border-top-width is a browser CSS property for element borders. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
border-top-width
Chrome 1+, Firefox 1+, Safari 1+, Edge 12+, Internet Explorer 4+. Keywords and length values are long-established.
99%Global support
Google Chrome1+
Full support
Mozilla Firefox1+
Full support
Apple Safari1+
Full support
Microsoft Edge12+
Full support
Opera3.5+
Full support
Samsung Internet1+
Full support
Internet Explorer4+
Full support
border-top-widthWidely supported
Bottom line: Safe to use everywhere for thin, medium, thick, and length values. Treat hairline as experimental until browser support catches up.
Remember
Key Takeaways
Role: set only the top border’s thickness with a keyword or length.
Needs style: pair with a visible border-top-style, or use border-top.
Initial value:medium. Not inherited.
Physical edge: always the top side. Use border-block-start-width for writing-mode-aware borders.
One line:border-top-width is the thickness dial for the top edge — turn on style (and color) so the dial has something to draw.
Frequently Asked Questions
It sets how thick the top border of an element is. It only changes the physical top edge, not the other three sides.
Width alone is not enough when border-top-style is none, which is the default. Set a visible style such as solid, and usually a color, or use the border-top shorthand.
The initial value is medium, which is typically about 3px. The border still stays hidden until you also set a visible border-top-style.
They are keyword sizes for the line. In practice they map to about 1px, 3px, and 5px. For exact control, use a length such as 2px or 0.25rem.
border-top-width always targets the physical top edge. border-block-start-width follows writing-mode and stays on the logical block-start side.
It is Baseline and widely available: Chrome 1+, Firefox 1+, Safari 1+, Edge 12+, and Internet Explorer 4+. It is a browser style property, not a Node.js, Deno, or Bun feature.