CSS border-left-color Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The border-left-color property sets the color of an element’s physical left border. It does not set width or style. You can also set this color with border-left or border-color.

The initial value is currentColor, so the left border matches the element’s text color until you override it. A visible border-left-style and non-zero border-left-width are still required for the color to show.

Baseline · Widely available.

Not deprecated. Standard <color> values are safe everywhere. Newer striped / <image-1D> border colors from CSS Borders Level 4 are not covered here and are not Baseline yet.

CSS Syntax

syntax.css
border-left-color: <color> | initial | inherit;

Accepts any CSS color: named colors, hex, rgb(), hsl(), currentColor, or transparent.

Property Values

ValueDescriptionTry it
<color>Any color: named, hex, rgb(), hsl(), and moreTry it
currentColorUses the element’s computed text color. This is the initial valueTry it
transparentFully transparent left border. Width still takes space if style is visibleTry it
initialResets to the initial value, currentColorTry it
inheritTakes the value from the parent elementTry it

How to Use border-left-color

Make sure a left border exists, then paint only its color.

  1. Give the element a left border with a visible style and width (or use border-left).
  2. Set border-left-color to any CSS color.
  3. Leave other sides alone — this property never colors top, right, or bottom.
  4. Prefer the longhand when width and style are already set and you only need to change the color.
PieceRequired?Role
Visible styleYesWithout solid (or similar), no border draws
WidthYes (non-zero)Zero width hides the colored line
ColorThis propertyDefaults to currentColor if unset
Left edge onlyBy designOther sides keep their own colors

Live Preview

Width and style stay fixed. Change only border-left-color and watch the left edge repaint.

The left border is already 4px solid. Only the color keyword changes.

Left edge

border-left-color: #0f172a

CSS Examples

Each snippet focuses on border-left-color. Use Try It Yourself for a live editor.

Example 1 — Hex Left Color

Paint the left border with a hex color after width and style are set.

CSS
<style>
  div {
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: #2563eb;
    padding: 12px;
  }
</style>

<div>Blue left border</div>
Try It Yourself

How It Works

  1. Create the left line. Width and style make a visible border on the left edge.
  2. Set only the color. border-left-color: #2563eb paints that line blue.
  3. Leave other sides alone. Top, right, and bottom keep whatever colors they already have.
  4. Same result with a shorthand. border-left: 4px solid #2563eb would set all three parts at once.

Example 2 — Match the Text Color

Use currentColor so the left border follows the element’s text color.

CSS
<style>
  div {
    color: #7c3aed;
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: currentColor;
    padding: 12px;
  }
</style>

<div>Matches text color</div>
Try It Yourself

How It Works

  1. Set the text color. color: #7c3aed is the source for currentColor.
  2. Keep a visible left border. Width and style still draw the line.
  3. Link the border to the text. currentColor copies that purple into the left border.
  4. Change one value later. Updating color updates the border too, without editing border-left-color again.

Example 3 — Transparent Left Color

Keep the left border’s space, but make the stroke invisible.

CSS
<style>
  div {
    border-left-width: 4px;
    border-left-style: solid;
    border-left-color: transparent;
    padding: 12px;
    background: #f1f5f9;
  }
</style>

<div>Invisible left stroke</div>
Try It Yourself

How It Works

  1. Keep width and style. The left border still exists in the box model.
  2. Set color to transparent. The stroke does not paint, so you do not see a line.
  3. Space remains. Unlike border-left-style: none, a transparent colored border can still reserve its width.
  4. Useful for alignment. Pair with other sides that stay opaque when you need matching padding without a visible left line.

Edge Cases & Pitfalls

If the left color seems missing, one of these is usually why.

style

Color alone never draws a border

You need a visible border-left-style and a non-zero width. Without them, border-left-color has nothing to paint.

shorthand

border-left can overwrite your color

A later border-left shorthand resets omitted parts, including color (back toward currentColor). Set the longhand after the shorthand if both are needed.

logical

Physical left is not always inline-start

In RTL layouts, use border-inline-start-color when the colored edge should follow the leading text side instead of the screen left.

default

Unset means currentColor

If you never set a left color, the border uses the element’s text color. That can look like a bug when you change text color and the border follows.

sides

Need every side the same color?

Use border-color. Reach for border-left-color when only the left edge should differ.

Browser Support

border-left-color is a browser CSS property for the box model. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

border-left-color

Supported in all modern browsers and Internet Explorer. Standard color values have been part of CSS since the earliest versions.

100% Universal support
Google Chrome All versions
Full support
Mozilla Firefox All versions
Full support
Apple Safari All versions
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support
Samsung Internet All versions
Full support
Internet Explorer All versions
Full support
border-left-color Widely supported

Bottom line: Safe everywhere for standard <color> values. Prefer the longhand when you only need to change the left color. It is not a runtime API.

Key Takeaways

  • Role: set the color of the physical left border only.
  • Needs a line first: visible style + width, then color.
  • Initial value: currentColor. Not inherited by default.
  • Shorthands: border-left and border-color can set the same color.

One line: use border-left-color when the left edge already has a border and you only need to change its paint.

Frequently Asked Questions

It sets the color of the border on the physical left edge only. It does not set width or style.
The initial value is currentColor, which uses the element's computed text color for the left border.
Color alone is not enough. You also need a visible border-left-style (such as solid) and a non-zero border-left-width, or use the border-left shorthand.
border-left-color always paints the physical left edge. border-inline-start-color follows writing direction, so in RTL text it usually maps to the right side.
Yes. border-left and border-color can set the left color. Use border-left-color when you want to change only the color after width and style are already set.
It is Baseline Widely available and works in all modern browsers and Internet Explorer. It is a browser CSS property, not a Node.js feature.

Next: border-left-style

Set the line style of the physical left border.

border-left-style tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful