CSS border-block-end-color Property

The border-block-end-color property sets the color of an element's logical block-end border.

The physical border affected depends on the element's writing mode. In horizontal writing, the property controls the bottom border color. In vertical writing, it controls either the left or right border color. It changes only the color, leaving the border's width and style unchanged.

border-block-end-color Syntax

selector {
  border-block-end-color: #1769aa;
}

The property accepts a single CSS color value or a CSS-wide keyword.

.named-color {
  border-block-end-color: blue;
}
.hex-color {
  border-block-end-color: #1769aa;
}
.rgb-color {
  border-block-end-color: rgb(23 105 170);
}
.transparent-color {
  border-block-end-color: transparent;
}
.text-color {
  border-block-end-color: currentColor;
}

CSS-wide values are also supported:

.example {
  border-block-end-color: inherit;
  border-block-end-color: initial;
  border-block-end-color: revert;
  border-block-end-color: revert-layer;
  border-block-end-color: unset;
}

These declarations illustrate the available global values. In a stylesheet, use the declaration that matches the intended cascade behavior.

Only one color value is accepted. To assign colors to both logical block borders, use border-block-color.

Property Values

Value Description
<color> A valid CSS color, including named colors, hexadecimal notation, and supported color functions.
currentColor Uses the element's computed text color. This is the initial value.
transparent Specifies a fully transparent border color without changing its width or style.
inherit Uses the parent's computed border-block-end-color value.
initial Resets the property to currentColor.
unset Resets the property to its initial value because it is not inherited.
revert Reverts the property according to the CSS cascade origin rules.
revert-layer Reverts the property according to CSS cascade layer rules.

The property is not inherited. Its initial value is currentColor, and its animation type is a color.

Because border-block-end-color is a longhand property, it does not reset the corresponding border width or style.

How It Works

The border-block-end-color property controls the color of one logical border. The block-end side is determined by the direction in which lines of text progress through a block.

Setting the Border Color

.panel {
  border-block-end: 4px solid;
  border-block-end-color: #1769aa;
}

The first declaration establishes the border width and style. The second sets its color to blue.

Changing an Existing Border

.panel {
  border-block-end: 3px solid gray;
  border-block-end-color: #d35400;
}

The border remains 3 pixels wide and solid, but its color changes from gray to orange.

Only the Block-End Side Changes

.panel {
  border-block: 3px solid #1769aa;
  border-block-end-color: #d35400;
}

The block-start border remains blue. Only the block-end border becomes orange.

Using the Property with Custom Colors

.panel {
  --divider-color: #1769aa;
  border-block-end: 3px solid;
  border-block-end-color: var(--divider-color);
}

A custom property makes the border color easier to reuse and update throughout a stylesheet.

Writing Modes and Border Mapping

The physical side affected by border-block-end-color depends on the element's writing-mode.

Writing Mode Physical Border Affected
horizontal-tb Bottom
vertical-rl Left
vertical-lr Right
sideways-rl Left
sideways-lr Right

Horizontal Writing Mode

.horizontal-panel {
  writing-mode: horizontal-tb;
  border-block-end: 4px solid;
  border-block-end-color: #1769aa;
}

The bottom border is blue.

Vertical Right-to-Left Writing Mode

.vertical-right-panel {
  writing-mode: vertical-rl;
  border-block-end: 4px solid;
  border-block-end-color: #1769aa;
}

The left border is blue.

Vertical Left-to-Right Writing Mode

.vertical-left-panel {
  writing-mode: vertical-lr;
  border-block-end: 4px solid;
  border-block-end-color: #1769aa;
}

The right border is blue.

Text Direction

.rtl-panel {
  direction: rtl;
  writing-mode: horizontal-tb;
  border-block-end: 4px solid;
  border-block-end-color: #1769aa;
}

The border remains at the bottom. Changing direction alone does not change the block-end side in horizontal writing mode.

Use logical border properties when styling must follow the content's writing mode rather than a fixed physical edge.

CSS Color Formats

The property supports the CSS color formats available in the browser.

Named Colors

.named {
  border-block-end-color: navy;
}

Hexadecimal Colors

.hex {
  border-block-end-color: #1769aa;
}

RGB Colors

.rgb {
  border-block-end-color: rgb(23 105 170);
}

HSL Colors

.hsl {
  border-block-end-color: hsl(207 76% 38%);
}

Colors with Transparency

.alpha {
  border-block-end-color: rgb(23 105 170 / 60%);
}

The alpha component determines how much of the underlying background remains visible through the border.

Using color-mix()

.mixed {
  border-block-end-color: color-mix(in srgb, #1769aa 70%, white);
}

The color-mix() function creates a color by mixing two colors in a specified color space.

Support for individual color functions may differ from support for border-block-end-color itself.

Using currentColor

The currentColor keyword represents the element's computed color value.

.matching-border {
  color: #1769aa;
  border-block-end: 3px solid;
  border-block-end-color: currentColor;
}

The block-end border matches the element's text color.

Default Border Color

.automatic-color {
  color: #1769aa;
  border-block-end: 3px solid;
}

The border uses currentColor automatically because no explicit color is supplied.

Using Inherited Text Color

.theme {
  color: #1769aa;
}
.theme .panel {
  border-block-end: 2px solid currentColor;
}

The panel inherits its text color from the parent, and the border uses that computed color.

Resetting to currentColor

.panel {
  color: #1769aa;
  border-block-end: 3px solid orange;
  border-block-end-color: initial;
}

The final declaration resets the border color to its initial value, currentColor, so the border matches the blue text color.

Although the border color property itself is not inherited, its currentColor value can reflect inherited text color.

Transparent Border Colors

The transparent keyword makes the border fully transparent without removing its width or style.

.transparent-panel {
  border-block-end: 4px solid;
  border-block-end-color: transparent;
}

The border is invisible but still occupies space in the box model.

Reserving Space for Hover

.hover-panel {
  border-block-end: 3px solid transparent;
}
.hover-panel:hover {
  border-block-end-color: #1769aa;
}

The transparent border reserves space before hover. Changing only the color prevents a change in border thickness.

Partial Transparency

.semi-transparent {
  border-block-end: 4px solid;
  border-block-end-color: rgb(23 105 170 / 50%);
}

A partially transparent border blends with the background beneath it.

Transparent vs. none

.transparent-border {
  border-block-end: 4px solid transparent;
}
.no-border {
  border-block-end: none;
}

The first element retains a 4-pixel border area. The second has no used border width because its border style is none.

Border Visibility

Changing the border color does not automatically create a visible border. The border also needs a visible style and a nonzero used width.

Color Alone

.invisible {
  border-block-end-color: red;
}

If the border style remains at its initial value of none, no border is displayed.

Setting Width and Style

.visible {
  border-block-end-width: 4px;
  border-block-end-style: solid;
  border-block-end-color: red;
}

The block-end border is now visible.

Using the Shorthand

.visible {
  border-block-end: 4px solid red;
}

The shorthand sets all three components in one declaration.

Changing Only the Color

.panel {
  border-block-end: 4px solid #1769aa;
}
.panel.warning {
  border-block-end-color: #d35400;
}

The warning class changes the color without modifying the existing width or style.

Several logical border properties work together to control border colors and appearance.

Property Purpose
border-block-end Sets the width, style, and color of the block-end border.
border-block-end-color Sets only the block-end border color.
border-block-end-style Sets only the block-end border style.
border-block-end-width Sets only the block-end border width.
border-block-start-color Sets the color of the opposite logical block border.
border-block-color Sets the colors of both logical block borders.
border-inline-color Sets the colors of the two logical inline borders.

Different Colors on Both Block Sides

.panel {
  border-block: 3px solid;
  border-block-start-color: #1769aa;
  border-block-end-color: #d35400;
}

The block-start border is blue, and the block-end border is orange.

Using border-block-color

.panel {
  border-block: 3px solid;
  border-block-color: #1769aa #d35400;
}

This produces the same result with a single color shorthand.

Logical vs. Physical Colors

.logical {
  border-block-end-color: blue;
}
.physical {
  border-bottom-color: blue;
}

In horizontal writing mode, both properties affect the bottom border. In vertical writing, border-block-end-color follows the block axis, while border-bottom-color always targets the physical bottom border.

Shorthand and Longhand Interactions

The border-block-end-color longhand can be overridden by broader border shorthands that reset the same border color.

Overriding border-block-end

.panel {
  border-block-end: 3px solid gray;
  border-block-end-color: blue;
}

The later color declaration changes the border to blue while retaining its width and style.

Shorthand Reset

.panel {
  border-block-end-color: blue;
  border-block-end: 3px solid orange;
}

The later shorthand replaces the blue color with orange.

Overriding border-block-color

.panel {
  border-block: 3px solid;
  border-block-color: blue;
  border-block-end-color: orange;
}

The block-start border remains blue, while the block-end border becomes orange.

The border Shorthand

.panel {
  border-block-end-color: blue;
  border: 2px solid gray;
}

The later border shorthand sets all four physical border colors to gray, overriding the earlier logical border color.

Cascade Priority

These examples assume equal origin, importance, specificity, and cascade layer priority. Higher-priority declarations can override later declarations.

For predictable styling, define general border rules first and place specific logical color overrides afterward.

Interactive States and Transitions

The property is useful for changing border colors during hover, focus, and other component states.

Hover Color

.interactive-panel {
  border-block-end: 3px solid #c5d8e8;
}
.interactive-panel:hover {
  border-block-end-color: #1769aa;
}

The block-end border changes from light blue to darker blue when hovered.

Smooth Color Transition

.animated-panel {
  border-block-end: 3px solid #c5d8e8;
  transition: border-block-end-color 200ms ease;
}
.animated-panel:hover {
  border-block-end-color: #1769aa;
}

The border color transitions smoothly between the two values.

Reduced Motion

@media (prefers-reduced-motion: reduce) {
  .animated-panel {
    transition: none;
  }
}

This removes the transition for users who prefer reduced motion.

Focus Indicator

.form-control {
  border: 1px solid #8a99a8;
  border-block-end: 3px solid #8a99a8;
}
.form-control:focus-visible {
  border-block-end-color: #1769aa;
  outline: 2px solid #1769aa;
  outline-offset: 2px;
}

The block-end border changes color on keyboard focus, while the outline provides an additional visible indicator.

When border colors communicate important information, provide sufficient contrast and avoid relying on color alone.

border-block-end-color Example

The following example demonstrates how border-block-end-color follows the logical block-end side in three writing modes.

Each box has a blue block-start border and an orange block-end border. The block-end color is assigned using border-block-end-color.

<div class="border-block-end-color-demo">
  <div class="demo-item">
    <p>horizontal-tb</p>
    <div class="demo-box horizontal">Block-end color</div>
  </div>
  <div class="demo-item">
    <p>vertical-rl</p>
    <div class="demo-box vertical-right">Block-end color</div>
  </div>
  <div class="demo-item">
    <p>vertical-lr</p>
    <div class="demo-box vertical-left">Block-end color</div>
  </div>
</div>
.border-block-end-color-demo {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}
.border-block-end-color-demo .demo-item {
  padding: 10px;
}
.border-block-end-color-demo .demo-item p {
  margin-bottom: 10px;
  font-weight: bold;
}
.border-block-end-color-demo .demo-box {
  box-sizing: border-box;
  inline-size: 180px;
  block-size: 120px;
  padding: 15px;
  border-block: 7px solid #1769aa;
  border-block-end-color: #d35400;
  background-color: #e8f2fb;
  color: #173b5e;
  font-weight: bold;
  text-align: center;
}
.border-block-end-color-demo .horizontal {
  writing-mode: horizontal-tb;
}
.border-block-end-color-demo .vertical-right {
  writing-mode: vertical-rl;
}
.border-block-end-color-demo .vertical-left {
  writing-mode: vertical-lr;
}
Browser Result

horizontal-tb

Block-end color

vertical-rl

Block-end color

vertical-lr

Block-end color

In horizontal-tb, the orange block-end border appears at the bottom.

In vertical-rl, the orange border appears on the left.

In vertical-lr, the orange border appears on the right.

The blue block-start border provides a visual comparison, showing that the orange color always follows the logical block-end side.

Important Considerations

Keep the following points in mind when using border-block-end-color:

  • Logical border color: The property sets only the color of the block-end border.
  • Writing mode: The affected physical side depends on writing-mode.
  • Horizontal writing: The property normally controls the bottom border color.
  • Vertical writing: It controls the left border color in vertical-rl and the right border color in vertical-lr.
  • Single color: The property accepts one CSS color value, not multiple side colors.
  • Initial value: The initial value is currentColor.
  • Inheritance: The property is not inherited, although currentColor can reflect inherited text color.
  • Color formats: Named colors, hexadecimal values, RGB, HSL, and supported color functions can be used.
  • Transparency: Transparent colors do not remove the border's layout space.
  • Border visibility: A visible border style and nonzero used width are required for the color to appear.
  • Width and style: The property does not modify border thickness or line style.
  • Individual side: It affects only the block-end border, not block-start or inline borders.
  • Both block sides: Use border-block-color to set both logical block border colors.
  • Shorthand resets: Later border, border-block, or border-block-end declarations can override the color.
  • Physical borders: Logical and physical color properties may target the same physical side depending on writing mode.
  • Animation: The property can be animated as a CSS color.
  • Compatibility: Support for newer CSS color functions should be checked separately.
  • Accessibility: Border colors used to indicate important states should have sufficient contrast and should not be the only visual cue.

Use border-block-end-color when the color of a single logical block border needs to change without affecting its width or style.

Browser Support

The border-block-end-color property has Baseline Widely available status and is supported in modern versions of Chrome, Edge, Firefox, Safari, and other major browsers.

The property does not require vendor prefixes. Support for individual CSS color functions may vary independently.

Standard Declaration

.panel {
  border-block-end: 3px solid;
  border-block-end-color: #1769aa;
}

Physical Border Fallback

.panel {
  border-bottom: 3px solid #1769aa;
}
@supports (border-block-end-color: red) {
  .panel {
    border-bottom: 0;
    border-block-end: 3px solid;
    border-block-end-color: #1769aa;
  }
}

This fallback assumes horizontal writing mode. Browsers supporting the logical property use the block-end border, while older browsers retain the physical bottom border.

For vertical writing modes, physical fallbacks must be adapted to the appropriate left or right side.

Visit Can I Use? to review current browser compatibility.

Specifications

The border-block-end-color property is defined in the CSS Logical Properties and Values Module Level 1 specification.

CSS Logical Properties and Values Module Level 1

General border color behavior is defined in the CSS Backgrounds and Borders Module Level 3 specification.

CSS Backgrounds and Borders Module Level 3