📏 CSS border-left-width
: Setting the Thickness of the Left Border
Borders can subtly define structure or boldly highlight key content. The CSS border-left-width
property gives you precise control over the width (thickness) of the left border of an element — a small detail with a big visual impact.
🧾 What is border-left-width
?
The border-left-width
property sets the thickness of the left border of an element. This property is often used with border-left-style
and border-left-color
to fully render a left border.
🧬 Syntax
selector {
border-left-width: thin | medium | thick | <length>;
}
🧪 Accepted Values
Value | Description |
---|---|
thin | A thin border (browser default value, usually 1–2px). |
medium | Medium thickness (default in most browsers, usually ~3px). |
thick | Thick border (usually ~5px). |
<length> | Exact custom thickness using units like px , em , % . |
🎯 Examples
1. Thin left border
div.note {
border-left-style: solid;
border-left-width: thin;
border-left-color: #999;
}
Subtle visual divider for a content block.
2. Custom width
aside {
border-left-style: solid;
border-left-width: 8px;
border-left-color: teal;
}
Makes a bold statement with a thick teal left border.
3. Using in a border shorthand
section {
border-left: 6px dashed orange;
}
Sets width, style, and color all at once using the shorthand border-left
.
🔍 Important Notes
- The border won’t appear unless you also set a
border-left-style
other thannone
. - You can combine this with media queries to make the border width responsive.
- It affects layout — a wider border adds to the element’s total width unless using
box-sizing: border-box
.
🛠️ Best Practices
- Use consistent widths across UI components for design cohesion.
- Match
border-left-width
withpadding-left
to balance spacing and alignment. - Combine with
:hover
or:focus
to visually indicate interaction. - Don’t rely on keywords (
thin
,medium
,thick
) for precision — use pixel or relative units when consistency matters.
✅ Browser Support
Fully supported in all modern browsers, including Chrome, Firefox, Edge, Safari, and IE 8+.
🔚 Conclusion
The border-left-width
property gives you precise control over the left edge’s thickness, allowing you to fine-tune layout and emphasize content. Paired with border-left-style
and border-left-color
, it forms a complete solution for custom border styling.