Use a keyword (thin, medium, thick) or a length such as 2px. One to four values control which sides share a thickness. It applies to all elements, including ::first-letter, and is not inherited. A width does nothing useful until border-style is a visible style such as solid.
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.
Write two lengths.2px 8px is a two-value shorthand.
First value = top and bottom. Those edges become 2px.
Second value = left and right. Those edges become 8px.
Need four different sides? Use four values in clockwise order: top, right, bottom, left.
Edge Cases & Pitfalls
If the border is missing or looks wrong, check these first.
style
Width without style stays invisible
The default border-style is none. Set solid, dashed, or another visible style, or use the border shorthand.
0
0 removes the painted edge
border-width: 0 is valid and draws no visible line, even if style and color are set. Negative lengths are invalid.
order
Remember the value order
Two values are top/bottom then left/right. Four values are top, right, bottom, left. Mixing them up is a common source of uneven boxes.
box
Thickness affects layout size
With the default content-box sizing, thicker borders make the element larger. 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-width is a browser CSS property for the box model. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
border-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-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: shorthand for border thickness on all four sides.
Needs style: pair with a visible border-style, or use border.
1–4 values: all sides, top/bottom + left/right, three-value, or clockwise four-value.
Initial value:medium per side. Not inherited.
One line:border-width is the thickness dial — turn on style (and color) so the dial has something to draw.
Frequently Asked Questions
It is a shorthand that sets the thickness of the border on all four sides. One value applies everywhere; up to four values set top, right, bottom, and left.
Width alone is not enough when border-style is none, which is the default. Set a visible style such as solid, and usually a color, or use the border shorthand.
Each side starts at medium, which is typically about 3px. The border still stays hidden until you also set a visible border-style.
One value: all sides. Two: top/bottom, then left/right. Three: top, left/right, bottom. Four: top, right, bottom, left (clockwise).
They are keyword sizes. In practice they map to about 1px, 3px, and 5px. For exact control, use a length such as 2px or 0.25rem.
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.