CSS border-inline-color Property
The border-inline-color property sets the colors of an element's logical inline-start and inline-end borders.
It accepts one or two CSS color values, allowing both inline borders to share a color or use different colors. The physical sides affected depend on the element's writing mode and text direction, making the property useful for multilingual and writing-mode-aware layouts.
border-inline-color Syntax
selector {
border-inline-color: #1769aa;
}
The property accepts one or two valid CSS color values.
One Color
.panel {
border-inline-color: #1769aa;
}
Both logical inline borders use the same blue color.
Two Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
The first color applies to inline-start, and the second applies to inline-end.
Named Colors
.panel {
border-inline-color: blue green;
}
The inline-start border is blue and the inline-end border is green.
RGB Colors
.panel {
border-inline-color: rgb(23 105 170) rgb(39 174 96);
}
Both borders use RGB color values.
Transparent Color
.panel {
border-inline-color: transparent;
}
Both inline borders become transparent without changing their styles or specified widths.
currentcolor Keyword
.panel {
color: #1769aa;
border-inline-color: currentcolor;
}
Both inline borders use the element's current text color.
CSS-Wide Keywords
.inherited {
border-inline-color: inherit;
}
.reset {
border-inline-color: initial;
}
.unset {
border-inline-color: unset;
}
.reverted {
border-inline-color: revert;
}
.layer-reverted {
border-inline-color: revert-layer;
}
CSS-wide keywords must be used alone and cannot be combined with other color values.
Property Values
The border-inline-color property accepts the standard CSS <color> data type.
| Value | Description |
|---|---|
<color> |
Sets the color of both logical inline borders when one value is supplied. |
<color> <color> |
Sets separate colors for inline-start and inline-end. |
currentcolor |
Uses the element's computed text color. |
transparent |
Uses a fully transparent color. |
inherit |
Inherits the corresponding computed border colors from the parent. |
initial |
Resets both colors to their initial value, currentcolor. |
unset |
Resets both colors to their initial values because border colors are not inherited. |
revert |
Reverts the colors according to cascade origin rules. |
revert-layer |
Reverts the colors according to cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | currentcolor for both inline sides |
| Inherited | No |
| Applies to | Elements that support the corresponding border properties |
| Animation type | By computed value type, using color interpolation |
| Percentages | Not applicable |
The property is a shorthand for border-inline-start-color and border-inline-end-color. Its computed results are represented by those individual properties.
How It Works
The browser determines the logical inline edges from the element's writing mode and direction, then applies the specified colors to those edges.
Step 1: Define Visible Borders
.panel {
border-inline-style: solid;
border-inline-width: 4px;
}
Both inline borders have a visible style and a width of 4 pixels.
Step 2: Assign the Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
The first color is assigned to inline-start, and the second color is assigned to inline-end.
Step 3: Determine the Physical Sides
.panel {
writing-mode: horizontal-tb;
direction: ltr;
}
In horizontal left-to-right writing, inline-start is the left edge and inline-end is the right edge.
Step 4: Complete the Declaration
.panel {
writing-mode: horizontal-tb;
direction: ltr;
border-inline-width: 4px;
border-inline-style: solid;
border-inline-color: #1769aa #27ae60;
}
The element displays a blue left border and a green right border.
Step 5: Reverse the Direction
.panel {
direction: rtl;
}
The blue inline-start border moves to the right, and the green inline-end border moves to the left.
The logical color assignments remain unchanged. Only their mapping to physical edges changes.
One and Two Values
The number of color values determines whether the inline borders share a color or use separate colors.
One Value
.panel {
border-inline-color: #1769aa;
}
The same blue color applies to inline-start and inline-end.
Two Values
.panel {
border-inline-color: #1769aa #27ae60;
}
The first color applies to inline-start, while the second applies to inline-end.
Mixed Color Formats
.panel {
border-inline-color: #1769aa rgb(39 174 96);
}
Different CSS color formats may be combined in the same declaration.
Using currentcolor With a Fixed Color
.panel {
color: #1769aa;
border-inline-color: currentcolor #27ae60;
}
The inline-start border follows the text color, while the inline-end border remains green.
One Transparent Border
.panel {
border-inline-color: transparent #1769aa;
}
The inline-start border is transparent, and the inline-end border is blue.
Invalid Number of Values
.invalid {
border-inline-color: red green blue;
}
Three color values are invalid because the property accepts only one or two colors.
Value Assignment Summary
| Number of Values | Assignment |
|---|---|
| 1 | Both inline-start and inline-end |
| 2 | First: inline-start; second: inline-end |
Unlike border-color, which accepts up to four colors for physical sides, border-inline-color accepts a maximum of two.
Logical Inline Edges
Logical inline edges are defined relative to the flow of inline content rather than fixed physical sides.
Inline-Start Color
.panel {
border-inline-start-color: #1769aa;
}
Only the logical inline-start border color is changed.
Inline-End Color
.panel {
border-inline-end-color: #27ae60;
}
Only the logical inline-end border color is changed.
Both Inline Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
The shorthand assigns both logical colors in a single declaration.
Equivalent Longhands
.panel {
border-inline-start-color: #1769aa;
border-inline-end-color: #27ae60;
}
These declarations are equivalent to the two-value shorthand.
Override One Side
.panel {
border-inline-color: #1769aa;
border-inline-end-color: #27ae60;
}
Both borders initially receive blue, but the later declaration changes the inline-end border to green.
Shorthand After Longhand
.panel {
border-inline-start-color: #27ae60;
border-inline-color: #1769aa;
}
The later shorthand sets both inline border colors to blue.
Use individual longhands when only one logical border color needs to change.
Writing Modes
The writing-mode property determines the physical orientation of the inline axis.
Horizontal Writing
.horizontal-panel {
writing-mode: horizontal-tb;
direction: ltr;
border-inline-color: #1769aa #27ae60;
}
The first color applies to the left border and the second to the right border.
Vertical Right-to-Left Writing Mode
.vertical-rl-panel {
writing-mode: vertical-rl;
direction: ltr;
border-inline-color: #1769aa #27ae60;
}
The first color applies to the top border and the second to the bottom border.
Vertical Left-to-Right Writing Mode
.vertical-lr-panel {
writing-mode: vertical-lr;
direction: ltr;
border-inline-color: #1769aa #27ae60;
}
The first color also applies to the top border and the second to the bottom border.
Vertical Writing With RTL Direction
.vertical-rtl-panel {
writing-mode: vertical-rl;
direction: rtl;
border-inline-color: #1769aa #27ae60;
}
The inline direction is reversed, so the first color applies to the bottom border and the second to the top border.
Writing Mode Mapping
| Writing Mode | Direction | Inline-Start | Inline-End |
|---|---|---|---|
horizontal-tb |
ltr |
Left | Right |
horizontal-tb |
rtl |
Right | Left |
vertical-rl |
ltr |
Top | Bottom |
vertical-rl |
rtl |
Bottom | Top |
vertical-lr |
ltr |
Top | Bottom |
vertical-lr |
rtl |
Bottom | Top |
The logical color order remains inline-start followed by inline-end, regardless of the physical orientation.
Text Direction
The direction property affects how logical inline-start and inline-end map to physical edges.
Left-to-Right Direction
.ltr-panel {
direction: ltr;
border-inline-style: solid;
border-inline-width: 5px;
border-inline-color: #1769aa #27ae60;
}
In horizontal writing mode, the left border is blue and the right border is green.
Right-to-Left Direction
.rtl-panel {
direction: rtl;
border-inline-style: solid;
border-inline-width: 5px;
border-inline-color: #1769aa #27ae60;
}
In horizontal writing mode, the right border is blue and the left border is green.
HTML Direction Attribute
<div dir="ltr" class="directional-panel">
Left-to-right content
</div>
<div dir="rtl" class="directional-panel">
Right-to-left content
</div>
.directional-panel {
padding: 20px;
border-inline: 5px solid;
border-inline-color: #1769aa #27ae60;
}
The same CSS works with both text directions. The logical border colors follow the direction established by each element.
Same Color on Both Sides
.directional-panel {
border-inline-color: #1769aa;
}
When both inline borders share a color, reversing direction does not change their visible color arrangement.
For multilingual HTML content, use the appropriate dir attribute to establish text direction.
CSS Color Values
The property supports standard CSS color formats, including named colors, hexadecimal colors, RGB, HSL, and newer color functions.
Named Colors
.panel {
border-inline-color: blue green;
}
Hexadecimal Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
RGB Colors
.panel {
border-inline-color: rgb(23 105 170) rgb(39 174 96);
}
RGB Colors With Alpha
.panel {
border-inline-color: rgb(23 105 170 / 80%) rgb(39 174 96 / 60%);
}
The alpha values control the opacity of each border color.
HSL Colors
.panel {
border-inline-color: hsl(207 76% 38%) hsl(145 63% 42%);
}
HWB Colors
.panel {
border-inline-color: hwb(207 9% 33%) hwb(145 15% 32%);
}
LAB Colors
.panel {
border-inline-color: lab(45% 0 -40) lab(65% -50 35);
}
OKLCH Colors
.panel {
border-inline-color: oklch(55% 0.15 250) oklch(65% 0.15 150);
}
CSS Custom Properties
:root {
--inline-start-color: #1769aa;
--inline-end-color: #27ae60;
}
.panel {
border-inline-color: var(--inline-start-color) var(--inline-end-color);
}
Custom properties make it easier to maintain consistent border colors across multiple components.
Browser support for individual color functions may differ from support for border-inline-color itself. Check compatibility when using newer color formats.
currentcolor Keyword
The currentcolor keyword uses the element's computed color value.
Matching Text and Border Colors
.panel {
color: #1769aa;
border-inline: 4px solid;
border-inline-color: currentcolor;
}
Both inline borders match the text color.
Default Border Color
.panel {
color: #1769aa;
border-inline: 4px solid;
}
The omitted color component defaults to currentcolor, so both borders use the text color.
One Current Color and One Fixed Color
.panel {
color: #1769aa;
border-inline: 4px solid;
border-inline-color: currentcolor #27ae60;
}
The inline-start border follows the text color, while the inline-end border remains green.
Changing the Text Color
.panel {
color: #1769aa;
border-inline: 4px solid currentcolor;
}
.panel:hover {
color: #27ae60;
}
Both borders change color when the element's text color changes.
Inherited Text Color
.wrapper {
color: #1769aa;
}
.wrapper .panel {
border-inline: 4px solid currentcolor;
}
The panel inherits its text color from the wrapper, and its inline borders use that color.
The border-color properties themselves are not inherited. The connection occurs through the inherited color property and the currentcolor keyword.
Transparent Colors
Transparent colors allow border space to remain in the layout without displaying a visible border color.
Both Borders Transparent
.panel {
border-inline: 4px solid;
border-inline-color: transparent;
}
Both borders retain their widths but become visually transparent.
Transparent Inline-Start
.panel {
border-inline: 4px solid;
border-inline-color: transparent #1769aa;
}
The inline-start border is transparent, while the inline-end border remains blue.
Transparent Inline-End
.panel {
border-inline: 4px solid;
border-inline-color: #1769aa transparent;
}
The inline-start border is blue, while the inline-end border is transparent.
Semi-Transparent Colors
.panel {
border-inline: 6px solid;
border-inline-color: rgb(23 105 170 / 50%) rgb(39 174 96 / 50%);
}
Both borders are partially transparent, allowing the background beneath them to influence their appearance.
Hover Effect Without Layout Shift
.panel {
border-inline: 4px solid transparent;
}
.panel:hover {
border-inline-color: #1769aa;
}
The border space is reserved before hovering, so changing the color does not alter the border thickness or cause a layout shift.
Transparent borders are useful for hover states, focus indicators, and interactive components that should maintain stable dimensions.
Border Styles and Widths
The border-inline-color property changes only border colors. It does not establish visible border styles or widths.
Color Without a Style
.panel {
border-inline-color: #1769aa;
}
No border appears if the inline border styles remain at their initial value of none.
Adding a Border Style
.panel {
border-inline-style: solid;
border-inline-color: #1769aa;
}
The borders become visible using the default medium width.
Adding a Border Width
.panel {
border-inline-width: 5px;
border-inline-style: solid;
border-inline-color: #1769aa;
}
Both inline borders are 5 pixels wide and blue.
Different Widths and Colors
.panel {
border-inline-width: 3px 8px;
border-inline-style: solid;
border-inline-color: #1769aa #27ae60;
}
The inline-start border is 3 pixels wide and blue. The inline-end border is 8 pixels wide and green.
Different Styles and Colors
.panel {
border-inline-width: 5px;
border-inline-style: dashed double;
border-inline-color: #1769aa #27ae60;
}
The inline-start border is dashed and blue, while the inline-end border is double and green.
Removing a Border Style
.panel {
border-inline: 5px solid #1769aa;
border-inline-style: none;
}
Both borders disappear because the style becomes none, even though their colors remain assigned.
For a visible border, combine a valid color with a style other than none or hidden and a nonzero width.
Shorthand Interactions
The border-inline-color property is a color shorthand. Other border shorthands can override or reset its values.
border-inline Shorthand
.panel {
border-inline: 4px solid #1769aa;
}
The declaration sets the widths, styles, and colors of both inline borders.
Color Shorthand After border-inline
.panel {
border-inline: 4px solid #1769aa;
border-inline-color: #1769aa #27ae60;
}
The later declaration changes the inline-end color to green without affecting the border widths or styles.
border-inline After Color Shorthand
.panel {
border-inline-color: #1769aa #27ae60;
border-inline: 4px solid #8e44ad;
}
The later border-inline shorthand resets both colors to purple.
border Shorthand
.panel {
border-inline-color: #1769aa #27ae60;
border: 4px solid #8e44ad;
}
The later border shorthand sets all physical border colors to purple, overriding the earlier logical color assignments where they map to the same physical edges.
border-color Shorthand
.panel {
border: 4px solid;
border-color: #1769aa #27ae60;
}
The border-color shorthand assigns colors to physical sides rather than logical inline edges.
Logical Color Shorthand After Physical Colors
.panel {
border: 4px solid #cccccc;
border-inline-color: #1769aa #27ae60;
}
The inline border colors override the corresponding physical border colors according to the element's writing mode and direction.
When logical and physical declarations target the same border component, the CSS cascade determines the winning value.
Logical vs. Physical Border Colors
Logical border colors follow the inline axis, while physical border colors remain attached to fixed sides.
| Property | Target | Writing-Mode Aware |
|---|---|---|
border-left-color |
Physical left border | No |
border-right-color |
Physical right border | No |
border-top-color |
Physical top border | No |
border-bottom-color |
Physical bottom border | No |
border-inline-start-color |
Logical inline-start border | Yes |
border-inline-end-color |
Logical inline-end border | Yes |
border-inline-color |
Both logical inline borders | Yes |
Physical Left and Right Colors
.panel {
border-left-color: #1769aa;
border-right-color: #27ae60;
}
These colors remain attached to the left and right edges regardless of text direction.
Logical Inline Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
These colors follow inline-start and inline-end.
Horizontal LTR Mapping
.panel {
writing-mode: horizontal-tb;
direction: ltr;
border-inline-color: #1769aa #27ae60;
}
The blue border appears on the left and the green border on the right.
Horizontal RTL Mapping
.panel {
writing-mode: horizontal-tb;
direction: rtl;
border-inline-color: #1769aa #27ae60;
}
The blue border appears on the right and the green border on the left.
Logical border colors are useful when the visual meaning of a border depends on the beginning or ending edge of the content.
border-block-color Comparison
The border-inline-color and border-block-color properties control colors along different logical axes.
Inline Border Colors
.panel {
border-inline-color: #1769aa #27ae60;
}
The colors apply to inline-start and inline-end.
Block Border Colors
.panel {
border-block-color: #8e44ad #e67e22;
}
The colors apply to block-start and block-end.
Combining Both Axes
.panel {
border: 4px solid;
border-inline-color: #1769aa #27ae60;
border-block-color: #8e44ad #e67e22;
}
All four logical edges receive independently assigned colors.
Horizontal Writing Mode
In horizontal left-to-right writing, inline colors apply to the left and right borders, while block colors apply to the top and bottom borders.
Vertical Writing Mode
In vertical writing modes, inline colors apply to the top and bottom borders, while block colors apply to the left and right borders.
Use both properties when a component needs distinct colors on all four logical edges.
Responsive Design
Logical border colors can adapt to viewport size, color schemes, and changes in writing mode.
Media Query Colors
.responsive-panel {
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
@media (max-width: 600px) {
.responsive-panel {
border-inline-color: #8e44ad #e67e22;
}
}
The inline border colors change on smaller screens.
Dark Color Scheme
.responsive-panel {
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
@media (prefers-color-scheme: dark) {
.responsive-panel {
border-inline-color: #66b3ff #65d69e;
}
}
The borders use lighter colors when the user prefers a dark color scheme.
Container Query
.panel-container {
container-type: inline-size;
}
.responsive-panel {
border-inline-color: #1769aa;
}
@container (min-width: 500px) {
.responsive-panel {
border-inline-color: #1769aa #27ae60;
}
}
The inline border colors change when the query container reaches the specified size.
Custom Property Colors
.responsive-panel {
--start-color: #1769aa;
--end-color: #27ae60;
border-inline: 4px solid;
border-inline-color: var(--start-color) var(--end-color);
}
@media (max-width: 600px) {
.responsive-panel {
--start-color: #8e44ad;
--end-color: #e67e22;
}
}
Custom properties allow the border colors to change without repeating the border declarations.
Writing-Mode Changes
.responsive-panel {
writing-mode: horizontal-tb;
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
@media (min-width: 900px) {
.responsive-panel {
writing-mode: vertical-rl;
}
}
The same color assignments follow the inline axis when the writing mode changes.
Practical Uses
The border-inline-color property is useful for navigation elements, content panels, interactive controls, and layouts that support multiple text directions.
Two-Color Content Panel
.content-panel {
padding: 24px;
border-inline: 5px solid;
border-inline-color: #1769aa #27ae60;
background-color: #f3f8fc;
}
The panel has blue and green borders on its logical inline edges.
Highlighted Section
.highlight-section {
padding: 20px;
border-inline: 6px double;
border-inline-color: #8e44ad #e67e22;
}
The highlighted section uses different colors on its double inline borders.
Navigation Hover Effect
.nav-link {
padding-inline: 16px;
border-inline: 3px solid transparent;
}
.nav-link:hover {
border-inline-color: #1769aa;
}
The borders become visible on hover without changing the element's dimensions.
Active Navigation Item
.nav-link {
border-inline: 3px solid transparent;
}
.nav-link[aria-current="page"] {
border-inline-color: #1769aa #27ae60;
}
The current navigation item receives two colored inline borders.
Directional Accent
.directional-accent {
padding: 20px;
border-inline: 5px solid;
border-inline-color: #1769aa transparent;
}
Only the inline-start border is visibly colored. Its physical position changes with the writing direction.
Animated Border Colors
.animated-panel {
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
transition: border-inline-color 0.3s ease;
}
.animated-panel:hover {
border-inline-color: #8e44ad #e67e22;
}
Both inline border colors transition when the element is hovered.
border-inline-color Example
The following example compares the same two logical border colors in horizontal left-to-right, horizontal right-to-left, and vertical writing modes.
<div class="border-inline-color-demo">
<div class="demo-item">
<h3>Horizontal LTR</h3>
<div class="demo-box horizontal-ltr">Inline colors</div>
</div>
<div class="demo-item">
<h3>Horizontal RTL</h3>
<div class="demo-box horizontal-rtl">Inline colors</div>
</div>
<div class="demo-item">
<h3>Vertical RL</h3>
<div class="demo-box vertical-rl">Inline colors</div>
</div>
</div>
.border-inline-color-demo {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 24px;
}
.border-inline-color-demo .demo-item {
min-width: 0;
}
.border-inline-color-demo h3 {
margin-bottom: 12px;
font-size: 1rem;
}
.border-inline-color-demo .demo-box {
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
min-height: 150px;
padding: 20px;
border-inline-width: 8px;
border-inline-style: solid;
border-inline-color: #1769aa #27ae60;
background-color: #f3f8fc;
color: #173b5e;
font-weight: bold;
text-align: center;
}
.border-inline-color-demo .horizontal-ltr {
writing-mode: horizontal-tb;
direction: ltr;
}
.border-inline-color-demo .horizontal-rtl {
writing-mode: horizontal-tb;
direction: rtl;
}
.border-inline-color-demo .vertical-rl {
writing-mode: vertical-rl;
direction: ltr;
}
All three examples use the same border width, style, and color values. Only the writing mode or direction changes.
Horizontal LTR
Horizontal RTL
Vertical RL
The first example uses horizontal left-to-right writing. The blue inline-start border appears on the left, and the green inline-end border appears on the right.
The second example reverses the text direction. The blue border moves to the right, and the green border moves to the left.
The third example uses vertical writing. The blue border appears at the top, and the green border appears at the bottom.
This demonstrates how border-inline-color follows logical inline edges rather than fixed physical sides.
Important Considerations
Keep the following points in mind when using border-inline-color:
- Purpose: Sets the colors of the logical inline-start and inline-end borders.
- Shorthand: Combines
border-inline-start-colorandborder-inline-end-color. - One value: Applies the same color to both inline borders.
- Two values: Assigns the first color to inline-start and the second to inline-end.
- Three values: Are invalid because the property accepts no more than two colors.
- Initial value: Both border colors initially use
currentcolor. - Inheritance: The border-color properties are not inherited.
- Writing mode: Determines whether the inline borders are horizontal or vertical edges.
- Text direction: Determines which physical edge corresponds to inline-start and inline-end.
- Horizontal LTR: Inline-start is left and inline-end is right.
- Horizontal RTL: Inline-start is right and inline-end is left.
- Vertical writing: The inline borders appear on the top and bottom.
- Color formats: Supports valid CSS colors, including hexadecimal, RGB, HSL, and newer color functions.
- currentcolor: Uses the element's computed text color.
- transparent: Makes the border color invisible without changing its specified width or style.
- Border style: A style other than
noneorhiddenis required for a visible border. - Border width: A nonzero computed width is required for a visible border.
- Layout: Changing only the border color does not change the element's dimensions.
- Logical longhands: Use individual start and end color properties to change one side.
- Physical colors: Avoid unintended conflicts with physical border-color declarations.
- Shorthand resets: A later
border-inlineshorthand may reset the colors. - Animation: Compatible border colors can be interpolated.
- Custom properties: Can provide reusable border colors for components and themes.
- Border images: A painted border image can cover the regular border colors.
- Browser support: Modern browsers support the standard property without vendor prefixes.
Use border-inline-color when border colors should follow the logical beginning and ending edges of content, particularly in multilingual or writing-mode-aware interfaces.
Browser Support
The border-inline-color property is widely available in current versions of Chrome, Edge, Firefox, Safari, and other major browsers.
The standard property does not require vendor prefixes in modern browsers.
Single Color
.panel {
border-inline: 4px solid;
border-inline-color: #1769aa;
}
Two Colors
.panel {
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
Vertical Writing Mode
.panel {
writing-mode: vertical-rl;
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
These examples use standard CSS logical border syntax.
Physical Border Fallback
.panel {
border-left: 4px solid #1769aa;
border-right: 4px solid #27ae60;
}
@supports (border-inline-color: red blue) {
.panel {
border-left: 0;
border-right: 0;
border-inline: 4px solid;
border-inline-color: #1769aa #27ae60;
}
}
This fallback assumes horizontal left-to-right writing. Older browsers use physical borders, while browsers supporting the logical property use inline-start and inline-end colors.
Visit Can I Use? and search for border-inline-color to review browser compatibility.
Specifications
The border-inline-color property is defined in the CSS Logical Properties and Values Module Level 1 specification.
CSS Logical Properties and Values Module Level 1
The specification defines how the shorthand assigns colors to logical inline-start and inline-end borders.
CSS color values and their behavior are defined in the CSS Color specification.
