Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Borders, Outlines and Shadows

The border-left property

Reference for the CSS border-left shorthand: set the width, style and color of only the left border, for callouts and quotes, with examples and notes.

The border-left property is a shorthand that sets the width, style and color of an element's left border only. Its longhands are border-left-width, border-left-style and border-left-color.

A thick colored left border is the standard decoration for blockquotes, notes and warning boxes, and a thin one makes a neat divider between columns.

CSS
blockquote {
  border-left: 4px solid #94a3b8;
  padding-left: 1em;
}

Try it

Callouts and quotes

Color alone should not be the only signal. Each callout starts with a word ("Info", "Warning", "Error") for readers who cannot tell the colors apart.

Syntax

CSS
border-left: <line-width> || <line-style> || <color>
  • Initial value: medium none currentcolor
  • Applies to: all elements
  • Inherited: no
  • Animatable: yes (width and color; style is discrete)
  • Computed value: see the longhands

Values

Value Description
<line-width> A length or thin, medium, thick. See border-width.
<line-style> solid, dashed, dotted, double, groove, ridge, inset, outset, none, hidden. See border-style.
<color> Any color value; omitted means currentcolor.

Usage notes

  • A style is required. border-left: 5px blue shows nothing without solid (or another style).
  • Round the opposite side only. A callout with a straight left accent usually rounds only the right corners (border-radius: 0 6px 6px 0). Rounding the left corners bends the border into a curved wedge.
  • Left is physical. In right-to-left scripts, a quote's accent should be on the right. Use border-inline-start (see border-inline) to follow the text direction automatically.
  • Separators. The li + li pattern with border-left adds dividers only between items, so nothing needs removing for the first or last.
  • Override order. Declare border before border-left so the side rule wins.
  • Padding. Give the content some padding-left so text does not touch the line.
  • Contrast and meaning. Do not rely on color alone for status; add text or an icon.

Browser support

Supported in every browser.