CSS border-left-style Property
The border-left-style property sets the line style used to draw an element's left border.
It supports styles such as solid, dashed, dotted, and double, along with several decorative styles. The property controls only the border's appearance, while its thickness and color are controlled by separate properties.
border-left-style Syntax
The border-left-style property accepts one border style keyword.
selector {
border-left-style: solid;
}
The general syntax is:
selector {
border-left-style: <line-style>;
}
Solid Border
.panel {
border-left-style: solid;
}
Dashed Border
.panel {
border-left-style: dashed;
}
Dotted Border
.panel {
border-left-style: dotted;
}
Double Border
.panel {
border-left-style: double;
}
Remove the Left Border
.panel {
border-left-style: none;
}
CSS-Wide Keywords
.inherited {
border-left-style: inherit;
}
.reset {
border-left-style: initial;
}
.unset {
border-left-style: unset;
}
.reverted {
border-left-style: revert;
}
.layer-reverted {
border-left-style: revert-layer;
}
Only one style value is accepted. To set multiple border sides, use the border-style shorthand.
Property Values
The property accepts ten border style keywords and the standard CSS-wide keywords.
| Value | Description |
|---|---|
none |
No border is drawn. The computed border width becomes zero. |
hidden |
No border is drawn. The computed width becomes zero, and the style has special priority in collapsed table border conflicts. |
dotted |
Draws a series of dots along the left border. |
dashed |
Draws a series of short line segments. |
solid |
Draws a continuous line. |
double |
Draws two parallel lines within the specified border width. |
groove |
Creates a carved or recessed appearance. |
ridge |
Creates a raised or ridged appearance. |
inset |
Creates an inset appearance using color shading. |
outset |
Creates an outset appearance using color shading. |
inherit |
Uses the computed left border style of the parent element. |
initial |
Resets the style to none. |
unset |
Resets the style to none because the property is not inherited. |
revert |
Reverts the property according to cascade origin rules. |
revert-layer |
Reverts the property according to cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | none |
| Inherited | No |
| Applies to | Elements that support border properties |
| Computed value | Specified keyword |
| Animation type | Discrete |
| Percentages | Not accepted |
| Property type | Longhand |
| Physical edge | Left |
The property controls only the style. A visible border also requires a nonzero computed width and a visible color.
How It Works
The browser uses the selected style to determine how the left border is drawn.
Step 1: Set the Style
.panel {
border-left-style: solid;
}
The browser uses the initial medium width and currentcolor color unless other declarations change them.
Step 2: Set the Width
.panel {
border-left-style: solid;
border-left-width: 5px;
}
The border becomes 5 pixels thick.
Step 3: Set the Color
.panel {
border-left-style: solid;
border-left-width: 5px;
border-left-color: #1769aa;
}
The result is a 5-pixel solid blue left border.
Step 4: Change the Style
.panel {
border-left: 5px solid #1769aa;
border-left-style: dashed;
}
The border becomes dashed without changing its width or color.
Step 5: Use the Shorthand
.panel {
border-left: 5px dashed #1769aa;
}
The shorthand combines the width, style, and color into one declaration.
Border Style Values
The available styles produce different visual treatments of the left border.
solid
.panel {
border-left: 6px solid #1769aa;
}
A continuous line suitable for panels, navigation accents, and highlighted content.
dashed
.panel {
border-left: 6px dashed #1769aa;
}
A series of dashes. Dash length and spacing are determined by the browser.
dotted
.panel {
border-left: 6px dotted #1769aa;
}
A series of dots. Dot shape and spacing may vary between browsers.
double
.panel {
border-left: 9px double #1769aa;
}
Two parallel lines separated by a gap. The complete double border fits within the specified width.
groove
.panel {
border-left: 10px groove #1769aa;
}
A decorative border that appears carved into the surrounding surface.
ridge
.panel {
border-left: 10px ridge #1769aa;
}
A decorative border that appears raised above the surrounding surface.
inset
.panel {
border-left: 10px inset #1769aa;
}
A shaded border intended to contribute to an inset appearance.
outset
.panel {
border-left: 10px outset #1769aa;
}
A shaded border intended to contribute to an outset appearance.
none
.panel {
border-left-style: none;
}
No border is drawn, and the computed border width becomes zero.
hidden
.panel {
border-left-style: hidden;
}
No border is drawn. This value also affects border conflict resolution in collapsed tables.
Decorative styles such as groove, ridge, inset, and outset may look different depending on browser rendering and border color.
none vs. hidden
Both none and hidden prevent the left border from being drawn, but they differ in collapsed table border conflict resolution.
| Behavior | none |
hidden |
|---|---|---|
| Visible border | No | No |
| Computed border width | Zero | Zero |
| Normal element appearance | No border | No border |
| Collapsed table conflicts | Lowest priority among competing border styles | Suppresses competing borders at the affected edge |
Using none
.panel {
border-left: 5px solid #1769aa;
border-left-style: none;
}
The left border disappears.
Using hidden
.panel {
border-left: 5px solid #1769aa;
border-left-style: hidden;
}
The left border also disappears.
Collapsed Table Example
table {
border-collapse: collapse;
}
td {
border: 2px solid #1769aa;
}
td.no-shared-border {
border-left-style: hidden;
}
When the cell's left border participates in collapsed border conflict resolution, hidden suppresses the border at that shared edge.
For ordinary elements, use none when removing a border. Use hidden when its collapsed table behavior is specifically needed.
Border Width and Color
The border-left-style property works with border-left-width and border-left-color.
Style Only
.panel {
border-left-style: solid;
}
The border uses the initial medium width and currentcolor color unless those values have been changed.
Width and Style
.panel {
border-left-width: 6px;
border-left-style: dashed;
}
Color and Style
.panel {
border-left-style: dotted;
border-left-color: #27ae60;
}
All Three Properties
.panel {
border-left-width: 8px;
border-left-style: double;
border-left-color: #1769aa;
}
Zero Width
.panel {
border-left-width: 0;
border-left-style: solid;
border-left-color: #1769aa;
}
No visible line appears because the width is zero.
Transparent Color
.panel {
border-left-width: 6px;
border-left-style: solid;
border-left-color: transparent;
}
The border retains its width but is invisible.
Using currentcolor
.panel {
color: #1769aa;
border-left-width: 6px;
border-left-style: solid;
border-left-color: currentcolor;
}
The border matches the element's text color.
A visible border generally requires a style other than none or hidden, a nonzero width, and a color that is not fully transparent.
Shorthand Properties
Several border shorthands can set or override the left border style.
border-left Shorthand
.panel {
border-left: 6px dashed #1769aa;
}
Sets the width, style, and color of the left border.
border-style Shorthand
.panel {
border-style: solid dashed dotted double;
}
The four values apply to the top, right, bottom, and left borders, respectively. The left border uses double.
Two-Value border-style
.panel {
border-style: solid dashed;
}
The top and bottom borders are solid. The left and right borders are dashed.
border Shorthand
.panel {
border: 3px solid #cccccc;
border-left-style: dashed;
}
All borders begin as solid, but the left border becomes dashed.
Later Shorthand Reset
.panel {
border-left-style: dashed;
border-left: 5px solid #1769aa;
}
The later shorthand changes the left border style to solid.
Omitted Style in a Shorthand
.panel {
border-left: 5px dashed #1769aa;
border-left: 5px #27ae60;
}
The second shorthand resets the style to none, so the border is no longer visible.
Use the longhand property when changing only the style without resetting the width or color.
Physical vs. Logical Border Styles
The border-left-style property always targets the physical left edge. Logical border styles follow writing mode and direction.
| Writing Mode | Direction | Logical Property Matching Left |
|---|---|---|
horizontal-tb |
ltr |
border-inline-start-style |
horizontal-tb |
rtl |
border-inline-end-style |
vertical-rl |
ltr or rtl |
border-block-end-style |
vertical-lr |
ltr or rtl |
border-block-start-style |
Physical Left Border
.panel {
border: 5px solid #1769aa;
border-left-style: dashed;
}
The left border becomes dashed regardless of text direction.
Logical Inline-Start Border
.panel {
border: 5px solid #1769aa;
border-inline-start-style: dashed;
}
In horizontal left-to-right writing, the left border becomes dashed. In right-to-left writing, the right border becomes dashed.
Logical Inline-End Border
.panel {
border: 5px solid #1769aa;
border-inline-end-style: dashed;
}
In horizontal left-to-right writing, the right border becomes dashed. In right-to-left writing, the left border becomes dashed.
Vertical Writing
.panel {
writing-mode: vertical-rl;
border: 5px solid #1769aa;
border-left-style: dashed;
}
The dashed style remains on the physical left edge.
Use border-left-style when the border must stay on the left. Use a logical border style when the border should follow the writing direction.
Cascade and Overrides
The CSS cascade determines which border style applies when multiple declarations target the same edge.
Later Declaration
.panel {
border-left-style: solid;
border-left-style: dashed;
}
The later dashed declaration wins when both have equal cascade priority.
Higher Specificity
.panel {
border-left-style: solid;
}
.panel.featured {
border-left-style: double;
}
The featured panel uses a double border.
Shorthand Override
.panel {
border-left: 5px solid #1769aa;
border-left-style: dotted;
}
The left border becomes dotted without changing its width or color.
Physical and Logical Conflict
.panel {
border: 5px solid #1769aa;
border-left-style: dashed;
border-inline-start-style: dotted;
}
In horizontal left-to-right writing, the later logical declaration makes the left border dotted when cascade priority is otherwise equal.
In horizontal right-to-left writing, the logical declaration targets the right border instead.
CSS Layers
@layer base, components;
@layer base {
.panel {
border-left-style: solid;
}
}
@layer components {
.panel {
border-left-style: dashed;
}
}
For normal declarations, the later layer takes precedence.
When a border style appears incorrect, check shorthand resets, selector specificity, cascade layers, and logical border declarations.
CSS Custom Properties
CSS custom properties can store reusable border styles for components and themes.
Shared Border Style
:root {
--accent-border-style: solid;
}
.panel {
border-left-width: 5px;
border-left-color: #1769aa;
border-left-style: var(--accent-border-style);
}
Fallback Style
.panel {
border-left: 5px solid #1769aa;
border-left-style: var(--panel-style, solid);
}
The fallback is used when the custom property is unavailable or has the guaranteed-invalid value.
Component Variants
.notice {
--notice-border-style: solid;
border-left: 5px solid #1769aa;
border-left-style: var(--notice-border-style);
}
.notice.dashed {
--notice-border-style: dashed;
}
.notice.dotted {
--notice-border-style: dotted;
}
Theme-Based Style
:root {
--panel-border-style: solid;
}
[data-theme="decorative"] {
--panel-border-style: double;
}
.panel {
border-left: 8px solid #1769aa;
border-left-style: var(--panel-border-style);
}
Custom properties help maintain consistent border treatments across multiple components.
Interactive States
The left border style can change in response to user interaction or application state.
Hover State
.panel {
border-left: 5px solid #1769aa;
}
.panel:hover {
border-left-style: dashed;
}
Focus State
.form-field {
border-left: 5px solid #cccccc;
}
.form-field:focus {
border-left-style: double;
}
Keyboard Focus
.form-field {
border-left: 5px solid #cccccc;
}
.form-field:focus-visible {
border-left-style: dashed;
outline: 2px solid #1769aa;
outline-offset: 2px;
}
The outline provides a separate visible focus indicator.
Selected Item
.selectable-panel {
border-left: 5px solid #cccccc;
}
.selectable-panel.is-selected {
border-left-style: double;
border-left-color: #1769aa;
}
Current Navigation Item
.nav-link {
border-left: 4px solid transparent;
}
.nav-link[aria-current="page"] {
border-left-color: #1769aa;
border-left-style: solid;
}
Invalid Form Field
.form-field {
border-left: 5px solid #cccccc;
}
.form-field[aria-invalid="true"] {
border-left-style: dashed;
border-left-color: #c0392b;
}
Border style changes can provide a visual distinction beyond color alone. Important states should also be communicated through text or accessible attributes.
Border styles animate discretely rather than transitioning smoothly between patterns.
Responsive Design
The left border style can change based on viewport size, container size, or user preferences.
Media Query
.panel {
border-left: 6px solid #1769aa;
}
@media (max-width: 600px) {
.panel {
border-left-style: dashed;
}
}
Container Query
.panel-container {
container-type: inline-size;
}
.panel {
border-left: 6px solid #1769aa;
}
@container (min-width: 500px) {
.panel {
border-left-style: double;
}
}
Theme Variation
.panel {
border-left: 6px solid #1769aa;
}
[data-theme="decorative"] .panel {
border-left-style: ridge;
}
Reduced Motion Preference
.panel {
border-left: 6px solid #1769aa;
transition: border-left-color 0.3s ease;
}
.panel:hover {
border-left-style: dashed;
border-left-color: #27ae60;
}
@media (prefers-reduced-motion: reduce) {
.panel {
transition: none;
}
}
The style changes discretely, while the color transition is disabled for users requesting reduced motion.
Responsive border styles can provide different visual treatments without changing the content structure.
Practical Uses
The border-left-style property can distinguish content types, navigation states, and interface components.
Information Panel
.info-panel {
padding: 20px;
border-left: 5px solid #1769aa;
background-color: #f3f8fc;
}
Draft Content
.draft-panel {
padding: 20px;
border-left: 5px dashed #d97706;
background-color: #fff8e8;
}
Optional Content
.optional-panel {
padding: 20px;
border-left: 5px dotted #8e44ad;
background-color: #f8f4fb;
}
Decorative Quote
blockquote {
margin: 20px 0;
padding-left: 20px;
border-left: 8px double #1769aa;
}
Selected Card
.card {
border-left: 5px solid #cccccc;
}
.card.is-selected {
border-left-style: double;
border-left-color: #27ae60;
}
Active Navigation
.nav-link {
border-left: 4px solid transparent;
}
.nav-link[aria-current="page"] {
border-left-style: solid;
border-left-color: #1769aa;
}
Choose border styles that reinforce the meaning of the content while remaining easy to distinguish.
border-left-style Example
The following example displays the eight visible border styles using a consistent width and color.
<div class="border-left-style-demo">
<div class="demo-box solid">Solid Border</div>
<div class="demo-box dashed">Dashed Border</div>
<div class="demo-box dotted">Dotted Border</div>
<div class="demo-box double">Double Border</div>
<div class="demo-box groove">Groove Border</div>
<div class="demo-box ridge">Ridge Border</div>
<div class="demo-box inset">Inset Border</div>
<div class="demo-box outset">Outset Border</div>
</div>
.border-left-style-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}
.border-left-style-demo .demo-box {
padding: 20px;
border-left-width: 10px;
border-left-color: #1769aa;
background-color: #f3f8fc;
color: #173b5e;
font-weight: bold;
}
.border-left-style-demo .solid {
border-left-style: solid;
}
.border-left-style-demo .dashed {
border-left-style: dashed;
}
.border-left-style-demo .dotted {
border-left-style: dotted;
}
.border-left-style-demo .double {
border-left-style: double;
}
.border-left-style-demo .groove {
border-left-style: groove;
}
.border-left-style-demo .ridge {
border-left-style: ridge;
}
.border-left-style-demo .inset {
border-left-style: inset;
}
.border-left-style-demo .outset {
border-left-style: outset;
}
Each example uses a 10-pixel left border with the same base color. Only the border style changes.
The exact rendering of dashed, dotted, and decorative border styles may vary between browsers.
Important Considerations
Keep the following points in mind when using border-left-style:
- Purpose: Sets the appearance of the physical left border.
- Property type: Longhand.
- Initial value:
none. - Inheritance: The property is not inherited.
- Physical edge: Always targets the left side.
- Accepted values: Ten border style keywords and CSS-wide keywords.
- Visible styles:
solid,dashed,dotted,double,groove,ridge,inset, andoutset. - none: Prevents the border from being drawn.
- hidden: Prevents the border from being drawn and affects collapsed table border conflicts.
- Computed width: Becomes zero when the style is
noneorhidden. - Width: Controlled separately by
border-left-width. - Color: Controlled separately by
border-left-color. - Shorthand:
border-leftsets width, style, and color together. - Shorthand resets: Later shorthand declarations may replace the style.
- Logical borders: May target the same physical edge depending on writing mode and direction.
- Animation: Border style changes are discrete rather than smoothly interpolated.
- Rendering: Decorative border styles may vary between browsers.
- Custom properties: Can store reusable border style keywords.
- Responsive design: Supports media queries and container queries.
- Accessibility: Use text or other indicators alongside visual border changes when communicating important states.
- Browser support: Supported by all major browsers.
Use border-left-style when the left border's appearance needs to change without resetting its width or color.
Browser Support
The border-left-style property is widely supported in Chrome, Edge, Firefox, Safari, and other major browsers.
It is a long-established CSS property and does not require vendor prefixes.
.panel {
border-left-width: 5px;
border-left-style: dashed;
border-left-color: #1769aa;
}
For current compatibility details, visit Can I Use? and search for border-left-style.
Specifications
The border-left-style property is defined in the CSS Backgrounds and Borders Module Level 3 specification.
CSS Backgrounds and Borders Module Level 3
The specification defines the available border style keywords and how they affect border rendering.
