CSS column-rule-color Property
The column-rule-color property sets the color of the decorative lines drawn between adjacent columns in a CSS multi-column layout.
It is one of three longhand properties controlled by the column-rule shorthand, along with column-rule-width and column-rule-style.
The property accepts CSS color values, including named colors, hexadecimal notation, RGB, HSL, and currentColor. A visible column-rule style must also be specified for the color to appear.
column-rule-color Syntax
The column-rule-color property accepts any valid CSS <color> value.
selector {
column-rule-color: #0066cc;
}
General Syntax
selector {
column-rule-color: <color>;
}
Named Color
.article {
column-rule-color: blue;
}
Hexadecimal Color
.article {
column-rule-color: #336699;
}
RGB Color
.article {
column-rule-color: rgb(51 102 153);
}
HSL Color
.article {
column-rule-color: hsl(210 50% 40%);
}
Current Text Color
.article {
column-rule-color: currentColor;
}
Transparent Color
.article {
column-rule-color: rgb(0 0 0 / 30%);
}
CSS-Wide Keywords
.article {
column-rule-color: inherit;
}
.article {
column-rule-color: initial;
}
.article {
column-rule-color: unset;
}
.article {
column-rule-color: revert;
}
.article {
column-rule-color: revert-layer;
}
Unlike the column-rule shorthand, this property changes only the rule color. It does not reset the rule's width or style.
Property Values
The property supports the CSS color data type and CSS-wide keywords.
| Value | Description |
|---|---|
red |
Uses a named CSS color. |
#336699 |
Uses a hexadecimal color value. |
rgb(51 102 153) |
Uses an RGB color value. |
hsl(210 50% 40%) |
Uses an HSL color value. |
rgb(0 0 0 / 40%) |
Uses a partially transparent color. |
transparent |
Makes the rule fully transparent. |
currentColor |
Uses the element's computed text color. |
var(--rule-color) |
Uses a color supplied through a CSS custom property. |
CSS-Wide Keywords
| Value | Description |
|---|---|
inherit |
Uses the computed value from the parent element. |
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 cascade origin rules. |
revert-layer |
Reverts the property according to cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | currentColor |
| Inherited | No |
| Applies to | Multi-column containers |
| Computed value | Computed color value |
| Animation type | By computed value type (color) |
| Percentages | Not applicable directly; permitted within supported color functions |
| Layout effect | Changes appearance without affecting column dimensions |
Although column-rule-color is not inherited, its initial value of currentColor can reflect an inherited text color.
How It Works
The browser uses column-rule-color when painting the decorative separators between adjacent columns.
Step 1: Create Multiple Columns
.article {
column-count: 3;
}
Step 2: Set the Column Gap
.article {
column-count: 3;
column-gap: 30px;
}
Step 3: Choose a Visible Rule Style
.article {
column-count: 3;
column-gap: 30px;
column-rule-style: solid;
column-rule-width: 2px;
}
Step 4: Set the Rule Color
.article {
column-count: 3;
column-gap: 30px;
column-rule-style: solid;
column-rule-width: 2px;
column-rule-color: #0066cc;
}
Step 5: Paint the Separators
The browser draws the colored rules in the center of the gaps between adjacent columns.
Result
The column widths, gaps, and content flow remain unchanged. Only the separator color is affected.
Important Distinction
Setting column-rule-color does not automatically make a separator visible. The default rule style is none, so a visible style must be set separately or through the shorthand.
Named Colors
CSS named colors provide a convenient way to specify common rule colors without numeric color values.
Blue
.article {
column-rule-color: blue;
}
Gray
.article {
column-rule-color: gray;
}
Red
.article {
column-rule-color: red;
}
Dark Slate Gray
.article {
column-rule-color: darkslategray;
}
Named Color Example
.article {
column-count: 2;
column-gap: 30px;
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: steelblue;
}
When to Use Named Colors
Named colors are easy to read and useful for demonstrations. Hexadecimal, RGB, or HSL values provide more precise control when matching a website's color palette.
Hexadecimal Colors
Hexadecimal color notation uses hexadecimal digits to specify red, green, and blue color components.
Six-Digit Hexadecimal Color
.article {
column-rule-color: #336699;
}
Three-Digit Hexadecimal Color
.article {
column-rule-color: #369;
}
The shorthand #369 represents the same color as #336699.
Eight-Digit Hexadecimal Color
.article {
column-rule-color: #33669980;
}
The final two digits represent the alpha channel. In this example, the rule is approximately 50% opaque.
Four-Digit Hexadecimal Color
.article {
column-rule-color: #3698;
}
Hexadecimal Color Example
.article {
column-count: 3;
column-gap: 25px;
column-rule: 2px solid;
column-rule-color: #0055aa;
}
When to Use Hexadecimal Colors
Hexadecimal notation is useful when working with defined brand colors or matching existing CSS color values.
RGB and RGBA Colors
RGB color notation defines colors using red, green, and blue channels. An optional alpha channel controls transparency.
Modern RGB Syntax
.article {
column-rule-color: rgb(51 102 153);
}
Legacy RGB Syntax
.article {
column-rule-color: rgb(51, 102, 153);
}
RGB with Alpha
.article {
column-rule-color: rgb(51 102 153 / 50%);
}
RGBA Syntax
.article {
column-rule-color: rgba(51, 102, 153, 0.5);
}
Percentage-Based RGB
.article {
column-rule-color: rgb(20% 40% 60%);
}
RGB Example
.article {
column-count: 2;
column-gap: 30px;
column-rule: 3px solid;
column-rule-color: rgb(0 102 204 / 70%);
}
When to Use RGB
RGB is useful when colors are defined numerically or when transparency is needed without changing the opacity of the entire multi-column container.
HSL and HSLA Colors
HSL color notation defines a color using hue, saturation, and lightness. An optional alpha channel controls transparency.
Modern HSL Syntax
.article {
column-rule-color: hsl(210 50% 40%);
}
Legacy HSL Syntax
.article {
column-rule-color: hsl(210, 50%, 40%);
}
HSL with Alpha
.article {
column-rule-color: hsl(210 50% 40% / 60%);
}
HSLA Syntax
.article {
column-rule-color: hsla(210, 50%, 40%, 0.6);
}
Adjusting Lightness
.article-light {
column-rule-color: hsl(210 50% 70%);
}
.article-dark {
column-rule-color: hsl(210 50% 30%);
}
HSL Example
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid;
column-rule-color: hsl(210 65% 45%);
}
When to Use HSL
HSL is useful when creating related separator colors by adjusting hue, saturation, or lightness.
currentColor
The currentColor keyword uses the element's computed color value.
It is the initial value of column-rule-color, allowing a rule to follow the text color without requiring a separate color declaration.
Default Color Behavior
.article {
color: #333333;
column-count: 2;
column-rule: 2px solid;
}
The omitted rule color uses currentColor, so the separator follows the element's text color.
Explicit currentColor
.article {
color: #0066cc;
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: currentColor;
}
Inherited Text Color
.content-wrapper {
color: #444444;
}
.article {
column-count: 2;
column-rule: 2px solid currentColor;
}
If the article inherits the text color, its column rule uses that color.
Changing Text Color
.article {
color: #333333;
column-rule: 2px solid currentColor;
}
.article.highlighted {
color: #0066cc;
}
When the element's computed text color changes, the rule color changes with it.
Important Distinction
The currentColor keyword refers to the computed color of the element receiving the column rule, not the color of individual paragraphs inside its columns.
Transparent Colors
Transparent colors allow the column rule to blend with the background.
Fully Transparent Rule
.article {
column-rule-color: transparent;
}
The rule remains defined, but its color is fully transparent.
Partially Transparent Rule
.article {
column-rule-color: rgb(0 0 0 / 25%);
}
Transparent Blue
.article {
column-rule-color: rgb(0 102 204 / 40%);
}
Hexadecimal Alpha
.article {
column-rule-color: #00000040;
}
Transparency Example
.article {
column-count: 3;
column-gap: 30px;
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: rgb(0 0 0 / 20%);
}
Transparency vs. opacity
.article {
opacity: 0.5;
}
Setting opacity affects the entire element, including its text and other rendered content. Using an alpha channel in column-rule-color changes only the separator's transparency.
Practical Consideration
Transparent rules can create subtle separators, but very low opacity may make them difficult to distinguish against the background.
column-rule Shorthand
The column-rule shorthand sets the width, style, and color of column separators in a single declaration.
Shorthand Example
.article {
column-rule: 2px solid #0066cc;
}
Equivalent Longhand Properties
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: #0066cc;
}
Changing Only the Color
.article {
column-rule: 2px solid #777777;
column-rule-color: #0066cc;
}
The longhand declaration changes the color while preserving the specified width and style.
Shorthand Reset Behavior
.article {
column-rule-color: red;
column-rule: 2px solid;
}
The shorthand resets the omitted color component to currentColor. The earlier red value is not preserved.
Declaration Order
.article {
column-rule: 2px solid #777777;
column-rule-color: red;
}
When declarations have equal cascade priority, the later longhand color declaration takes precedence.
When to Use the Longhand
Use column-rule-color when the rule's width and style are already defined and only the color needs to change.
Rule Style and Visibility
A visible rule style is required for the selected color to appear.
Color Without Style
.article {
column-count: 2;
column-rule-color: red;
}
No separator appears because the initial value of column-rule-style is none.
Solid Rule
.article {
column-rule-style: solid;
column-rule-color: red;
}
Dashed Rule
.article {
column-rule-style: dashed;
column-rule-color: #0066cc;
}
Dotted Rule
.article {
column-rule-style: dotted;
column-rule-color: #777777;
}
Double Rule
.article {
column-rule-width: 4px;
column-rule-style: double;
column-rule-color: #555555;
}
Hidden Rule
.article {
column-rule-style: none;
column-rule-color: blue;
}
The color value remains defined, but no rule is painted.
Rule Width
The initial width is medium. Specify column-rule-width when a particular separator thickness is required.
Column Gap and Positioning
Column rules are painted within the gaps between adjacent columns.
Basic Column Gap
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid #999999;
}
Changing the Rule Color
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid #999999;
column-rule-color: #0066cc;
}
Rule Position
The separator is centered within the column gap. Changing its color does not move the rule.
No Additional Layout Space
The rule is decorative and does not increase the gap or reduce column widths.
Single-Column Layout
.article {
column-count: 1;
column-rule-color: red;
}
No separator is visible because the layout has no adjacent columns.
Narrow Column Gaps
A thick rule may extend beyond a narrow gap. Changing its color does not prevent this overlap.
Recommended Approach
Choose an appropriate column gap and rule width before adjusting the rule color.
Dynamic Colors
The column-rule-color property can use CSS custom properties, color functions, and media queries to adapt separator colors.
CSS Custom Property
:root {
--column-divider: #999999;
}
.article {
column-rule: 2px solid;
column-rule-color: var(--column-divider);
}
Component-Specific Color
.article {
--column-divider: #0066cc;
column-rule: 2px solid var(--column-divider);
}
Dark Mode
.article {
column-rule: 1px solid #cccccc;
}
@media (prefers-color-scheme: dark) {
.article {
column-rule-color: #777777;
}
}
Using light-dark()
:root {
color-scheme: light dark;
}
.article {
column-rule: 2px solid;
column-rule-color: light-dark(#bbbbbb, #777777);
}
The light-dark() function selects a color based on the element's used color scheme.
Using color-mix()
.article {
column-rule: 2px solid;
column-rule-color: color-mix(in srgb, currentColor 30%, transparent);
}
Color Transitions
.article {
column-rule: 2px solid #999999;
transition: column-rule-color 0.3s ease;
}
.article:hover {
column-rule-color: #0066cc;
}
Because the property uses color values, browsers can interpolate between compatible colors during transitions and animations.
Practical Consideration
Custom properties and color functions make it easier to maintain consistent separators across multiple components and color schemes.
Practical Uses
Changing the color of column rules can improve visual separation while keeping the layout unchanged.
Documentation Columns
.documentation {
column-count: 2;
column-gap: 30px;
column-rule: 1px solid;
column-rule-color: #cccccc;
}
Reference Lists
.reference-list {
column-width: 220px;
column-gap: 25px;
column-rule: 1px dashed;
column-rule-color: #999999;
}
Technical Articles
.technical-article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid;
column-rule-color: #336699;
}
Subtle Dividers
.content {
column-count: 2;
column-gap: 30px;
column-rule: 1px solid;
column-rule-color: rgb(0 0 0 / 20%);
}
Theme-Based Separators
.content {
--divider-color: #cccccc;
column-count: 2;
column-gap: 30px;
column-rule: 2px solid var(--divider-color);
}
High-Contrast Separators
.content {
color: #222222;
column-count: 2;
column-gap: 30px;
column-rule: 2px solid currentColor;
}
When Not to Use
Do not use column-rule-color to change borders between Grid or Flexbox items. It applies to the decorative separators generated by CSS multi-column layout.
column-rule-color Example
The following example demonstrates four column-rule colors using the same two-column layout.
Each example uses a 3-pixel solid rule and a 30-pixel column gap. Only the color changes.
<div class="column-rule-color-demo">
<div class="rule-example">
<h3>Blue Rule</h3>
<div class="rule-columns blue-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls how those elements are presented, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>Gray Rule</h3>
<div class="rule-columns gray-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls how those elements are presented, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>Red Rule</h3>
<div class="rule-columns red-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls how those elements are presented, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>Transparent Black Rule</h3>
<div class="rule-columns transparent-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls how those elements are presented, including colors, spacing, and layout.</p>
</div>
</div>
</div>
.column-rule-color-demo {
display: grid;
gap: 20px;
}
.column-rule-color-demo .rule-example {
padding: 15px;
border: 1px solid #cccccc;
background-color: #f8f9fa;
}
.column-rule-color-demo h3 {
margin: 0 0 12px;
font-size: 1.125rem;
}
.column-rule-color-demo .rule-columns {
column-count: 2;
column-gap: 30px;
column-rule-width: 3px;
column-rule-style: solid;
}
.column-rule-color-demo .rule-columns p {
margin: 0;
}
.column-rule-color-demo .blue-rule {
column-rule-color: #0066cc;
}
.column-rule-color-demo .gray-rule {
column-rule-color: #777777;
}
.column-rule-color-demo .red-rule {
column-rule-color: #cc3333;
}
.column-rule-color-demo .transparent-rule {
column-rule-color: rgb(0 0 0 / 25%);
}
@media (max-width: 600px) {
.column-rule-color-demo .rule-columns {
column-count: 1;
}
}
Blue Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls how those elements are presented, including colors, spacing, and layout.
Gray Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls how those elements are presented, including colors, spacing, and layout.
Red Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls how those elements are presented, including colors, spacing, and layout.
Transparent Black Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls how those elements are presented, including colors, spacing, and layout.
The blue, gray, and red examples demonstrate solid separators with different colors. The transparent black example creates a softer separator by using an alpha channel.
Because the width and style remain the same, the layout and rule thickness are consistent across all four examples.
On narrow screens, the media query switches the content to one column. With no adjacent columns, the separators are not displayed.
Accessibility
Column-rule colors can improve visual separation, but they should remain decorative and should not be the only way to communicate important information.
Maintain Visibility
Choose colors that remain distinguishable from the background, particularly when using thin or partially transparent rules.
Avoid Color-Only Meaning
Do not rely on the color of a column rule to indicate categories, warnings, or other information without supporting text or semantic structure.
Support Dark Mode
Test rule colors against both light and dark backgrounds. Media queries, currentColor, and CSS custom properties can help maintain visibility.
Forced Colors
Test separators in forced-colors modes. Browser color adjustments may change the appearance of decorative rules.
Preserve Reading Order
Changing rule color does not affect the HTML document order or how assistive technologies encounter the content.
Avoid Distracting Colors
Bright or highly saturated rules can compete with text. Subtle separators are often more appropriate for long-form reading.
Responsive Layouts
Ensure the columns remain readable at increased zoom levels and on narrow screens. Rule colors cannot compensate for columns that are too narrow.
Important Considerations
Keep the following points in mind when using column-rule-color:
- Purpose: Sets the color of decorative separators between adjacent CSS columns.
- Initial value:
currentColor. - Inheritance: The property is not inherited.
- Valid values: Any supported CSS
<color>value. - Named colors: Values such as
red,blue, andgrayare supported. - Hexadecimal colors: Three-, four-, six-, and eight-digit notation can be used.
- RGB and HSL: Both modern and legacy color function syntax are supported.
- Transparency: Alpha channels allow partially transparent separators.
- currentColor: Uses the computed text color of the multi-column container.
- Visibility: A visible
column-rule-styleis required for the rule to appear. - Rule width: Controlled separately by
column-rule-width. - Shorthand: The
column-ruleproperty can set width, style, and color together. - Shorthand resets: Omitted shorthand components return to their initial values.
- Position: Rules are centered within column gaps.
- Layout: Changing the color does not affect column widths, gaps, or content flow.
- Single column: No separator is visible when there are no adjacent columns.
- Animations: Color values can be interpolated during transitions and animations.
- Custom properties: CSS variables can supply reusable separator colors.
- Color schemes: Media queries and color functions can adapt separators to light and dark themes.
- Accessibility: Maintain visible separators and avoid relying on color alone to communicate meaning.
Use column-rule-color when you need to adjust the separator color without changing its width or style. For a complete rule declaration, use the column-rule shorthand.
Browser Support
The column-rule-color property is widely supported in modern browsers, including Chrome, Edge, Firefox, and Safari.
It is part of the established CSS Multi-column Layout specification and can be used without vendor prefixes in current browsers.
Basic Example
.article {
column-count: 3;
column-gap: 30px;
column-rule-style: solid;
column-rule-width: 2px;
column-rule-color: #0066cc;
}
Shorthand Equivalent
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid #0066cc;
}
Compatibility Considerations
Older browsers sometimes required vendor-prefixed multi-column properties. Modern browsers support the standard unprefixed syntax.
For current compatibility information, visit Can I Use? and search for column-rule-color.
Specifications
The column-rule-color property is defined in CSS Multi-column Layout Module Level 1.
CSS Multi-column Layout Module Level 1
The specification defines the property's accepted color values, initial value, and relationship to the column-rule shorthand.
