CSS border-bottom-color Property
The border-bottom-color property sets the color of an element's physical bottom border.
It accepts CSS color values, including named colors, hexadecimal notation, color functions, currentColor, and transparent. The property changes only the bottom border's color, leaving its specified width and style unchanged.
border-bottom-color Syntax
selector {
border-bottom-color: #1769aa;
}
The property accepts a single CSS color value or a CSS-wide keyword.
.named-color {
border-bottom-color: blue;
}
.hex-color {
border-bottom-color: #1769aa;
}
.rgb-color {
border-bottom-color: rgb(23 105 170);
}
.hsl-color {
border-bottom-color: hsl(207 76% 38%);
}
.current-color {
border-bottom-color: currentColor;
}
.transparent-color {
border-bottom-color: transparent;
}
CSS-wide keywords are also supported:
.inherited {
border-bottom-color: inherit;
}
.reset {
border-bottom-color: initial;
}
.unset {
border-bottom-color: unset;
}
.reverted {
border-bottom-color: revert;
}
.layer-reverted {
border-bottom-color: revert-layer;
}
Only one color value is permitted. Multiple colors in the same declaration are invalid.
Property Values
| Value | Description |
|---|---|
| Named color | A CSS color name such as red, blue, or rebeccapurple. |
| Hexadecimal color | A color written with hexadecimal notation, such as #1769aa or #f80. |
rgb() |
Defines a color using red, green, and blue components, with optional alpha transparency. |
hsl() |
Defines a color using hue, saturation, and lightness, with optional alpha transparency. |
hwb() |
Defines a color using hue, whiteness, and blackness. |
lab(), lch(), oklab(), oklch() |
Define colors using modern CSS color spaces. |
color() |
Specifies a color in a supported color space. |
currentColor |
Uses the element's computed text color. This is the initial value. |
transparent |
Creates a fully transparent border color. |
CSS-Wide Keywords
| Keyword | Behavior |
|---|---|
inherit |
Uses the parent's computed bottom border color. |
initial |
Resets the property to currentColor. |
unset |
Resets the property to currentColor because it is not inherited. |
revert |
Reverts the property according to cascade origin rules. |
revert-layer |
Reverts the property according to cascade layer rules. |
The property is not inherited, has an initial value of currentColor, and supports color interpolation for animation.
How It Works
The border-bottom-color property changes the color of the bottom border without changing its specified thickness or line style.
Setting a Bottom Border Color
.panel {
border-bottom: 4px solid;
border-bottom-color: #1769aa;
}
The bottom border is 4 pixels thick, solid, and blue.
Changing an Existing Border
.panel {
border-bottom: 3px dashed #777;
border-bottom-color: #d35400;
}
The later declaration changes the color to orange while preserving the 3-pixel dashed border.
Color Without a Border Style
.panel {
border-bottom-color: red;
}
If no other border declarations apply, the border remains invisible because its initial style is none.
Color Without an Explicit Width
.panel {
border-bottom-style: solid;
border-bottom-color: #1769aa;
}
The border uses the initial width of medium because no explicit width is provided.
Changing Only the Bottom Edge
.panel {
border: 2px solid #777;
border-bottom-color: #1769aa;
}
All four borders remain 2 pixels thick and solid. Only the bottom border changes to blue.
CSS Color Formats
The property supports CSS color formats, allowing bottom border colors to be defined using different notations.
Named Colors
.named-example {
border-bottom: 4px solid;
border-bottom-color: royalblue;
}
Hexadecimal Colors
.hex-example {
border-bottom: 4px solid;
border-bottom-color: #1769aa;
}
RGB Colors
.rgb-example {
border-bottom: 4px solid;
border-bottom-color: rgb(23 105 170);
}
HSL Colors
.hsl-example {
border-bottom: 4px solid;
border-bottom-color: hsl(207 76% 38%);
}
HWB Colors
.hwb-example {
border-bottom: 4px solid;
border-bottom-color: hwb(207 9% 33%);
}
Modern Color Spaces
.oklch-example {
border-bottom: 4px solid;
border-bottom-color: oklch(55% 0.15 250);
}
Modern color functions provide additional ways to define colors. Their browser support should be checked separately when compatibility with older browsers is required.
Using color-mix()
.mixed-color {
border-bottom: 4px solid;
border-bottom-color: color-mix(in srgb, #1769aa 70%, white);
}
The color-mix() function creates a color by mixing two specified colors.
Using currentColor
The currentColor keyword uses the element's computed color value. It is the initial value of border-bottom-color.
Matching the Text Color
.heading {
color: #1769aa;
border-bottom: 3px solid currentColor;
}
The bottom border matches the heading's text color.
Omitting the Border Color
.heading {
color: #1769aa;
border-bottom: 3px solid;
}
Because no border color is specified, the border uses currentColor.
Changing the Text Color
.link {
color: #1769aa;
border-bottom: 2px solid currentColor;
}
.link:hover {
color: #d35400;
}
When the text color changes on hover, the bottom border changes with it.
Inherited Text Color
.container {
color: #1769aa;
}
.container .panel {
border-bottom: 3px solid currentColor;
}
The panel uses its computed text color, which it inherits from the container unless another declaration overrides it.
Use currentColor when borders should remain visually consistent with surrounding text.
Transparent and Semi-Transparent Borders
CSS color values can include transparency, allowing the bottom border to blend with the background or remain invisible while preserving its width.
Fully Transparent Border
.transparent-panel {
border-bottom: 4px solid;
border-bottom-color: transparent;
}
The border remains part of the box model but is not visibly painted.
Semi-Transparent RGB Color
.translucent-panel {
border-bottom: 4px solid;
border-bottom-color: rgb(23 105 170 / 50%);
}
The bottom border is painted with 50% opacity, allowing the background to show through.
Semi-Transparent HSL Color
.hsl-alpha-panel {
border-bottom: 4px solid;
border-bottom-color: hsl(207 76% 38% / 60%);
}
Hover Effect Without Layout Shift
.nav-link {
border-bottom: 3px solid transparent;
}
.nav-link:hover {
border-bottom-color: #1769aa;
}
The transparent border reserves space before hover. Changing its color does not change the element's border thickness.
Transparency vs. none
.transparent-border {
border-bottom: 4px solid transparent;
}
.no-border {
border-bottom: none;
}
The transparent border has a used width of 4 pixels and occupies space. The none border has a used width of zero.
Border Visibility
A bottom border's visibility depends on its color, style, and used width.
Visible Border
.visible {
border-bottom-width: 4px;
border-bottom-style: solid;
border-bottom-color: #1769aa;
}
The border is visible because it has a nonzero width, a visible style, and an opaque color.
Style none
.none-style {
border-bottom-width: 4px;
border-bottom-style: none;
border-bottom-color: #1769aa;
}
The border is not visible because the none style produces a used width of zero.
Zero Width
.zero-width {
border-bottom-width: 0;
border-bottom-style: solid;
border-bottom-color: #1769aa;
}
The border has no thickness and is not visible.
Transparent Color
.transparent-color {
border-bottom-width: 4px;
border-bottom-style: solid;
border-bottom-color: transparent;
}
The border occupies space but is fully transparent.
Style hidden
.hidden-style {
border-bottom-width: 4px;
border-bottom-style: hidden;
border-bottom-color: #1769aa;
}
The hidden style suppresses border painting and produces a used width of zero. It also has special precedence in collapsed table border conflicts.
Shorthand Interactions
The border-bottom-color longhand can be overridden by broader border shorthand properties.
Changing the Color After border-bottom
.panel {
border-bottom: 4px solid #777;
border-bottom-color: #1769aa;
}
The final bottom border is 4 pixels thick, solid, and blue.
Resetting the Color with border-bottom
.panel {
border-bottom-color: red;
border-bottom: 4px solid;
}
The later shorthand resets the color to currentColor because no color is included.
Using border-color
.panel {
border: 2px solid;
border-bottom-color: #1769aa;
border-color: #777;
}
The later border-color shorthand sets all four border colors to gray, overriding the earlier bottom border color.
Using the border Shorthand
.panel {
border-bottom-color: #1769aa;
border: 2px solid #777;
}
The later border shorthand resets all four border colors to gray.
Using a Longhand After border
.panel {
border: 2px solid #777;
border-bottom-color: #1769aa;
}
All four borders remain 2 pixels thick and solid, but the bottom border is blue.
These examples assume equal cascade origin, importance, specificity, and layer priority. Higher-priority declarations can override later declarations.
Logical vs. Physical Border Colors
The border-bottom-color property always targets the physical bottom edge. Logical border color properties follow the writing mode and text direction.
| Writing Mode | border-bottom-color |
border-block-end-color |
|---|---|---|
horizontal-tb |
Bottom | Bottom |
vertical-rl |
Bottom | Left |
vertical-lr |
Bottom | Right |
sideways-rl |
Bottom | Left |
sideways-lr |
Bottom | Right |
Physical Bottom Border Color
.physical {
writing-mode: vertical-rl;
border: 4px solid #777;
border-bottom-color: #1769aa;
}
The physical bottom border is blue, regardless of the writing mode.
Logical Block-End Border Color
.logical {
writing-mode: vertical-rl;
border: 4px solid #777;
border-block-end-color: #1769aa;
}
The physical left border becomes blue because it is the logical block-end edge in vertical-rl.
Logical Inline-End Border Color
.inline-end {
writing-mode: vertical-rl;
direction: ltr;
border: 4px solid #777;
border-inline-end-color: #1769aa;
}
In this example, the inline-end edge maps to the physical bottom border.
Use border-bottom-color when the physical bottom border must be targeted. Use logical properties when the border should follow the writing direction.
Dynamic Colors and Transitions
The border-bottom-color property can respond to interactive states, custom properties, and CSS transitions.
Hover Color
.link {
border-bottom: 2px solid #777;
}
.link:hover {
border-bottom-color: #1769aa;
}
The bottom border changes from gray to blue on hover.
Smooth Color Transition
.animated-link {
border-bottom: 3px solid transparent;
transition: border-bottom-color 200ms ease;
}
.animated-link:hover {
border-bottom-color: #1769aa;
}
@media (prefers-reduced-motion: reduce) {
.animated-link {
transition: none;
}
}
The border color transitions smoothly without changing the element's dimensions.
Focus State
.form-control {
border: 1px solid #777;
border-bottom: 3px solid #777;
}
.form-control:focus-visible {
border-bottom-color: #1769aa;
outline: 2px solid #1769aa;
outline-offset: 2px;
}
The bottom border changes color on keyboard focus, while the outline provides a visible focus indicator.
Using Custom Properties
.theme-panel {
--accent-color: #1769aa;
border-bottom: 4px solid;
border-bottom-color: var(--accent-color);
}
.theme-panel.warning {
--accent-color: #d35400;
}
Changing the custom property updates the bottom border color without rewriting the border declaration.
Using color-mix()
.soft-divider {
--accent-color: #1769aa;
border-bottom: 2px solid;
border-bottom-color: color-mix(in srgb, var(--accent-color) 40%, white);
}
The mixed color produces a lighter border based on the selected accent color.
Practical Uses
Bottom border colors are useful for navigation indicators, section dividers, headings, and interactive form controls.
Active Navigation Link
.nav-link {
border-bottom: 3px solid transparent;
}
.nav-link[aria-current="page"] {
border-bottom-color: #1769aa;
}
The active link receives a visible bottom border. The aria-current attribute identifies the current page for assistive technologies.
Section Heading Accent
.section-heading {
border-bottom: 3px solid;
border-bottom-color: #1769aa;
padding-bottom: 10px;
}
The colored border adds a visual accent beneath the heading.
Subtle Content Divider
.content-divider {
border-bottom: 1px solid;
border-bottom-color: #d0d7de;
padding-bottom: 20px;
}
A light border separates content without creating a strong visual emphasis.
Form Validation State
.form-input {
border: 1px solid #777;
border-bottom: 3px solid #777;
}
.form-input[aria-invalid="true"] {
border-bottom-color: #b42318;
}
The border color provides a visual indication of an invalid field. Pair this styling with an accessible error message rather than relying on color alone.
Themed Component
.info-panel {
--border-accent: #1769aa;
border-bottom: 4px solid;
border-bottom-color: var(--border-accent);
}
.info-panel.success {
--border-accent: #287d46;
}
Custom properties allow related components to share the same border styling while using different accent colors.
border-bottom-color Example
The following example compares several bottom border colors, including a semi-transparent color, currentColor, and a transparent border.
<div class="border-bottom-color-demo">
<div class="demo-box blue">Hex Color</div>
<div class="demo-box orange">RGB Color</div>
<div class="demo-box translucent">Semi-Transparent</div>
<div class="demo-box current">currentColor</div>
<div class="demo-box transparent">Transparent</div>
</div>
.border-bottom-color-demo {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.border-bottom-color-demo .demo-box {
box-sizing: border-box;
width: 180px;
padding: 20px 12px;
border-bottom-width: 6px;
border-bottom-style: solid;
background-color: #e8f2fb;
color: #173b5e;
font-weight: bold;
text-align: center;
}
.border-bottom-color-demo .blue {
border-bottom-color: #1769aa;
}
.border-bottom-color-demo .orange {
border-bottom-color: rgb(211 84 0);
}
.border-bottom-color-demo .translucent {
border-bottom-color: rgb(23 105 170 / 35%);
}
.border-bottom-color-demo .current {
color: #a33c21;
border-bottom-color: currentColor;
}
.border-bottom-color-demo .transparent {
border-bottom-color: transparent;
}
The first box uses a hexadecimal color, while the second uses an RGB color.
The third box demonstrates alpha transparency. The fourth uses currentColor to match the border to its text color.
The fifth box has a transparent bottom border. Its 6-pixel border still occupies space even though it is not visible.
Important Considerations
Keep the following points in mind when using border-bottom-color:
- Physical edge: Always controls the color of the physical bottom border.
- Initial value: The initial value is
currentColor. - Inheritance: The property is not inherited.
- Color values: Accepts supported CSS color values, including named colors, hexadecimal notation, and color functions.
- One value: Only a single color value is permitted.
- currentColor: Uses the element's computed text color.
- Transparent borders: A transparent border can still occupy space in the box model.
- Alpha transparency: Semi-transparent colors allow the background to show through.
- Border style: A border with style
noneorhiddenis not visible. - Border width: A border with zero used width is not visible.
- Independent control: Changing the color does not change the specified border width or style.
- Shorthand resets: Later
border-bottom,border-color, orborderdeclarations may override the color. - Writing modes: The physical bottom edge remains unchanged when the writing mode changes.
- Logical alternatives: Use logical border color properties when the affected edge should follow the writing mode.
- Transitions: Border colors can be animated between compatible color values.
- Browser compatibility: Support for newer color functions may differ from support for the property itself.
- Accessibility: Do not rely on border color alone to communicate important information.
Use border-bottom-color when the bottom border's color should change without resetting its existing width or style.
Browser Support
The border-bottom-color property is widely supported across Chrome, Edge, Firefox, Safari, and other major browsers, including older browser versions.
The standard property does not require vendor prefixes. Support for newer CSS color functions such as oklch() and color-mix() may vary independently.
Standard Declaration
.panel {
border-bottom: 4px solid;
border-bottom-color: #1769aa;
}
Color Function Fallback
.panel {
border-bottom: 4px solid;
border-bottom-color: #1769aa;
border-bottom-color: oklch(55% 0.15 250);
}
Browsers that do not support the newer color function ignore that declaration and retain the earlier hexadecimal color.
Visit Can I Use? and search for border-bottom-color to review compatibility.
Specifications
The border-bottom-color property is defined in the CSS Backgrounds and Borders Module Level 3 specification.
CSS Backgrounds and Borders Module Level 3
CSS color values and modern color functions are defined in the CSS Color specifications.
