CSS column-rule Property

The column-rule property is a shorthand property that draws a decorative line between adjacent columns in a CSS multi-column layout.

It combines three properties: column-rule-width, column-rule-style, and column-rule-color. Together, they control the thickness, appearance, and color of the separator.

Column rules are drawn within the space created by column-gap. They do not occupy additional layout space or change the width of the columns.

column-rule Syntax

The column-rule shorthand accepts a width, style, and color in any order. One or more components may be omitted.

selector {
  column-rule: 2px solid #666666;
}

General Syntax

selector {
  column-rule: <line-width> || <line-style> || <color>;
}

The double vertical bars indicate that the components may appear in any order, but each component can appear no more than once.

Width, Style, and Color

.article {
  column-rule: 2px solid #333333;
}

Style and Color

.article {
  column-rule: dashed #0066cc;
}

Width and Style

.article {
  column-rule: 3px dotted;
}

Style Only

.article {
  column-rule: solid;
}

Color Only

.article {
  column-rule: red;
}

Setting only a color does not make the rule visible because the omitted style resets to none.

CSS-Wide Keywords

.article {
  column-rule: inherit;
}
.article {
  column-rule: initial;
}
.article {
  column-rule: unset;
}
.article {
  column-rule: revert;
}
.article {
  column-rule: revert-layer;
}

CSS-wide keywords must be used alone rather than combined with individual width, style, or color values.

Property Values

The column-rule shorthand combines values from three longhand properties.

Component Example Description
column-rule-width 2px Specifies the thickness of the rule.
column-rule-style solid Specifies the line pattern or appearance.
column-rule-color #666666 Specifies the rule color.

Common Shorthand Values

Value Result
1px solid black A thin, solid black separator.
2px dashed blue A blue separator made of dashes.
3px dotted #777777 A dotted gray separator.
4px double #444444 A double-line separator.
medium solid currentColor A solid separator using the element's current text color.
none No visible separator.

Property Characteristics

Characteristic Value
Initial value Individual longhand initial values
Inherited No
Applies to Multi-column containers
Computed value Determined by each longhand property
Animation type Determined by each longhand property
Percentages Not accepted for rule width
Layout effect Decorative only; does not change column sizing

The initial longhand values are medium for width, none for style, and currentColor for color. Because the initial style is none, no rule is drawn by default.

How It Works

The browser draws column rules between adjacent columns after determining the multi-column layout.

Step 1: Create Multiple Columns

.article {
  column-count: 3;
}

Step 2: Set Column Spacing

.article {
  column-count: 3;
  column-gap: 30px;
}

Step 3: Add a Column Rule

.article {
  column-count: 3;
  column-gap: 30px;
  column-rule: 2px solid #777777;
}

Step 4: Position the Rule

The browser draws each rule in the center of the gap between adjacent columns.

Step 5: Preserve Column Dimensions

The rule does not consume additional layout space. Column widths and gap sizes remain unchanged.

Step 6: Handle Additional Columns

If the layout generates more columns, rules appear between the adjacent columns according to the fragmentation and multi-column layout rules.

Important Distinction

A column rule is a decorative line, not a border on an individual column. It cannot be used to assign separate borders to specific content columns.

Column Rule Width

The column-rule-width component controls the thickness of the separator.

Thin Rule

.article {
  column-rule: thin solid #666666;
}

Medium Rule

.article {
  column-rule: medium solid #666666;
}

Thick Rule

.article {
  column-rule: thick solid #666666;
}

Pixel Width

.article {
  column-rule: 3px solid #666666;
}

Relative Width

.article {
  column-rule: 0.2em solid #666666;
}

Width Without Style

.article {
  column-rule: 4px;
}

The rule remains invisible because the omitted style is reset to none.

Rule Width and Gap

The rule width does not affect the column gap. If the rule is wider than the gap, it can extend into the content columns.

Column Rule Style

The column-rule-style component determines the visual appearance of the separator.

Value Description
none No rule is drawn.
hidden Hides the rule.
solid Draws a continuous line.
dotted Draws a dotted line.
dashed Draws a dashed line.
double Draws two parallel lines.
groove Draws a carved or recessed appearance.
ridge Draws a raised appearance.
inset Draws an inset-style line.
outset Draws an outset-style line.

Solid

.article {
  column-rule: 2px solid #555555;
}

Dashed

.article {
  column-rule: 2px dashed #555555;
}

Dotted

.article {
  column-rule: 3px dotted #555555;
}

Double

.article {
  column-rule: 4px double #555555;
}

Groove

.article {
  column-rule: 5px groove #888888;
}

Style Considerations

Some three-dimensional styles depend on browser rendering and the selected color. A simple solid or dashed rule is often easier to distinguish.

Column Rule Color

The column-rule-color component controls the color of the separator.

Named Color

.article {
  column-rule: 2px solid blue;
}

Hexadecimal Color

.article {
  column-rule: 2px solid #0066cc;
}

RGB Color

.article {
  column-rule: 2px solid rgb(0 102 204);
}

HSL Color

.article {
  column-rule: 2px solid hsl(210 100% 40%);
}

Transparent Color

.article {
  column-rule: 2px solid rgb(0 0 0 / 30%);
}

Current Text Color

.article {
  color: #333333;
  column-rule: 2px solid currentColor;
}

The currentColor keyword uses the element's computed color value. It is also the initial value of column-rule-color.

Color Without Style

.article {
  column-rule: red;
}

This resets the rule style to none, so no visible separator appears.

Color Considerations

Choose a rule color that is visible against the background without distracting from the content.

Shorthand Behavior

The column-rule shorthand sets all three longhand properties, including those not explicitly provided.

Complete Shorthand

.article {
  column-rule: 2px solid #777777;
}

Equivalent Longhand Declarations

.article {
  column-rule-width: 2px;
  column-rule-style: solid;
  column-rule-color: #777777;
}

Omitted Width

.article {
  column-rule: solid #777777;
}

The width resets to its initial value of medium.

Omitted Color

.article {
  column-rule: 2px solid;
}

The color resets to currentColor.

Omitted Style

.article {
  column-rule: 2px #777777;
}

The style resets to none, making the rule invisible.

Order of Values

.article {
  column-rule: solid 2px #777777;
}
.article-alt {
  column-rule: #777777 solid 2px;
}

Both declarations are valid because the components may appear in any order.

Resetting Previous Values

.article {
  column-rule: 4px dashed red;
  column-rule: solid;
}

The second declaration resets the width to medium and the color to currentColor. It does not preserve the earlier width or color.

Overriding a Single Component

.article {
  column-rule: 2px solid #777777;
  column-rule-color: #0066cc;
}

Use a longhand property when you need to change only one component without resetting the others.

Relationship with column-gap

The column-gap property controls the spacing between columns, while column-rule draws a line within that space.

Gap Without Rule

.article {
  column-count: 3;
  column-gap: 30px;
}

Gap with Rule

.article {
  column-count: 3;
  column-gap: 30px;
  column-rule: 1px solid #cccccc;
}

Rule Position

The rule is drawn in the center of the gap between adjacent columns.

Rule Does Not Increase Gap

A 4-pixel rule inside a 30-pixel gap does not create 34 pixels of spacing. The gap remains 30 pixels.

Rule Wider Than Gap

.article {
  column-count: 3;
  column-gap: 10px;
  column-rule: 20px solid #666666;
}

The rule can extend beyond the gap into the adjacent content columns because it does not affect their sizing.

Zero Gap

.article {
  column-count: 3;
  column-gap: 0;
  column-rule: 1px solid #666666;
}

The rule can still be painted, but the lack of spacing may cause it to overlap the content.

Recommended Spacing

Use a gap wide enough to provide comfortable separation on both sides of the rule.

Column Count and Width

A column rule becomes visible only when a multi-column layout generates adjacent columns.

Using column-count

.article {
  column-count: 3;
  column-gap: 30px;
  column-rule: 1px solid #999999;
}

Using column-width

.article {
  column-width: 220px;
  column-gap: 25px;
  column-rule: 1px solid #999999;
}

The browser determines how many columns fit within the available width.

Using Both Properties

.article {
  column-count: 3;
  column-width: 220px;
  column-gap: 25px;
  column-rule: 1px solid #999999;
}

Single-Column Layout

.article {
  column-count: 1;
  column-rule: 2px solid red;
}

No separator is visible because there are no adjacent columns.

Automatic Column Changes

When the available width changes, the browser may generate fewer columns. The number of visible rules changes with the number of adjacent columns.

Content Flow

The rule does not affect the sequence in which content flows from one column to another.

Writing Modes

Column rules follow the orientation and flow of the multi-column layout.

Horizontal Writing Mode

.article {
  writing-mode: horizontal-tb;
  column-count: 3;
  column-rule: 2px solid #777777;
}

In a horizontal writing mode, the rule typically appears as a vertical separator between columns.

Vertical Writing Mode

.article {
  writing-mode: vertical-rl;
  column-count: 3;
  column-rule: 2px solid #777777;
}

In a vertical writing mode, the column arrangement changes and the rules follow the corresponding column boundaries.

Right-to-Left Content

.article {
  direction: rtl;
  column-count: 3;
  column-rule: 2px solid #777777;
}

The direction of content flow changes, but the rules remain positioned between adjacent columns.

Rule Orientation

Column rules are drawn perpendicular to the inline direction and extend along the column's block direction.

Practical Consideration

Test column rules with the writing modes used by your content, especially when supporting vertical scripts or right-to-left languages.

Responsive Layouts

Column rules can remain part of a responsive multi-column layout as the number of columns changes.

Desktop Layout

.article {
  column-count: 3;
  column-gap: 30px;
  column-rule: 1px solid #cccccc;
}

Tablet Layout

@media (max-width: 900px) {
  .article {
    column-count: 2;
    column-gap: 24px;
  }
}

Mobile Layout

@media (max-width: 600px) {
  .article {
    column-count: 1;
    column-gap: 0;
    column-rule: none;
  }
}

Automatic Columns

.article {
  column-width: 240px;
  column-gap: 25px;
  column-rule: 1px solid #cccccc;
}

Using column-width allows the browser to adjust the number of columns based on available space.

Responsive Rule Color

@media (prefers-color-scheme: dark) {
  .article {
    column-rule-color: #888888;
  }
}

When to Remove Rules

A single-column layout has no adjacent columns to separate, so the rule is not painted. Explicitly setting column-rule: none is optional but can make responsive styling easier to understand.

Practical Uses

Column rules are useful when a visible separator helps distinguish adjacent columns of flowing content.

Multi-column Articles

.article {
  column-count: 3;
  column-gap: 30px;
  column-rule: 1px solid #cccccc;
}

Reference Lists

.reference-list {
  column-width: 220px;
  column-gap: 25px;
  column-rule: 1px dashed #aaaaaa;
}

Documentation Sections

.documentation {
  column-count: 2;
  column-gap: 35px;
  column-rule: 2px solid #dddddd;
}

Technical Glossaries

.glossary {
  column-width: 240px;
  column-gap: 30px;
  column-rule: 1px dotted #999999;
}

High-Contrast Separators

.content {
  column-count: 2;
  column-gap: 30px;
  column-rule: 2px solid currentColor;
}

Subtle Separators

.content {
  column-count: 2;
  column-gap: 30px;
  column-rule: 1px solid rgb(0 0 0 / 20%);
}

When Not to Use

Do not use column-rule to create borders between Grid or Flexbox items. Those layout systems require other techniques, such as borders on items or pseudo-elements.

column-rule Example

The following example demonstrates four different column-rule styles using the same two-column layout.

Each example uses a 30-pixel column gap. Only the rule's appearance changes.

<div class="column-rule-demo">
  <div class="rule-example">
    <h3>Solid Rule</h3>
    <div class="rule-columns solid-rule">
      <p>HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.</p>
      <p>CSS controls the appearance of these elements, including typography, spacing, colors, and layout.</p>
    </div>
  </div>
  <div class="rule-example">
    <h3>Dashed Rule</h3>
    <div class="rule-columns dashed-rule">
      <p>HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.</p>
      <p>CSS controls the appearance of these elements, including typography, spacing, colors, and layout.</p>
    </div>
  </div>
  <div class="rule-example">
    <h3>Dotted Rule</h3>
    <div class="rule-columns dotted-rule">
      <p>HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.</p>
      <p>CSS controls the appearance of these elements, including typography, spacing, colors, and layout.</p>
    </div>
  </div>
  <div class="rule-example">
    <h3>Double Rule</h3>
    <div class="rule-columns double-rule">
      <p>HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.</p>
      <p>CSS controls the appearance of these elements, including typography, spacing, colors, and layout.</p>
    </div>
  </div>
</div>
.column-rule-demo {
  display: grid;
  gap: 20px;
}
.column-rule-demo .rule-example {
  padding: 15px;
  border: 1px solid #cccccc;
  background-color: #f8f9fa;
}
.column-rule-demo h3 {
  margin: 0 0 12px;
  font-size: 1.125rem;
}
.column-rule-demo .rule-columns {
  column-count: 2;
  column-gap: 30px;
}
.column-rule-demo .rule-columns p {
  margin: 0;
}
.column-rule-demo .solid-rule {
  column-rule: 2px solid #555555;
}
.column-rule-demo .dashed-rule {
  column-rule: 2px dashed #0066cc;
}
.column-rule-demo .dotted-rule {
  column-rule: 3px dotted #888888;
}
.column-rule-demo .double-rule {
  column-rule: 4px double #555555;
}
@media (max-width: 600px) {
  .column-rule-demo .rule-columns {
    column-count: 1;
  }
}
Browser Result

Solid Rule

HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.

CSS controls the appearance of these elements, including typography, spacing, colors, and layout.

Dashed Rule

HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.

CSS controls the appearance of these elements, including typography, spacing, colors, and layout.

Dotted Rule

HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.

CSS controls the appearance of these elements, including typography, spacing, colors, and layout.

Double Rule

HTML provides the structure of web pages. Elements define headings, paragraphs, links, and other content.

CSS controls the appearance of these elements, including typography, spacing, colors, and layout.

The solid example displays a continuous separator. The dashed and dotted examples use repeating patterns, while the double example displays two parallel lines.

The column gap remains unchanged in every example. Only the rule width, style, and color differ.

On narrow screens, the media query switches the content to one column. With no adjacent columns, no column rules are displayed.

Accessibility

Column rules can help readers distinguish adjacent columns, but they should remain decorative and should not replace semantic structure.

Maintain Visual Contrast

Choose a rule color that is visible against the background without competing with the text.

Avoid Excessively Thick Rules

Wide rules can overlap content when the column gap is too narrow.

Preserve Reading Order

Column rules do not change the HTML document order or the sequence in which assistive technologies encounter content.

Do Not Depend on Color Alone

If the separator communicates an important distinction, use appropriate headings or other semantic markup rather than relying on rule color.

Responsive Layouts

Test column layouts at increased text sizes and browser zoom levels. Switch to fewer columns when necessary to preserve readability.

Forced Colors

Test separators in forced-colors modes. Using currentColor can help the rule adapt to the element's text color.

Decorative Nature

Column rules are visual decorations and are not represented as separate semantic elements in the document.

Important Considerations

Keep the following points in mind when using column-rule:

  • Purpose: Draws decorative separators between adjacent columns in a multi-column layout.
  • Shorthand: Combines column-rule-width, column-rule-style, and column-rule-color.
  • Value order: Width, style, and color may appear in any order.
  • Omitted values: Reset to their respective initial values.
  • Initial width: medium.
  • Initial style: none.
  • Initial color: currentColor.
  • Inheritance: The longhand properties are not inherited.
  • Visibility: A visible rule style is required for the separator to appear.
  • Position: Rules are drawn in the center of column gaps.
  • Layout space: Rules do not increase gap size or affect column widths.
  • Wide rules: May extend into adjacent columns if wider than the gap.
  • Single column: No rule appears when only one column is generated.
  • Multiple columns: Rules are painted between adjacent columns.
  • Writing modes: Rule orientation follows the multi-column layout.
  • Column count: The number of visible rules depends on the generated columns.
  • Grid and Flexbox: Column rules are not general-purpose separators for these layout systems.
  • Responsive design: Rules disappear naturally when a layout has only one column.
  • Accessibility: Use appropriate contrast and preserve readable column widths.

Use column-rule when a multi-column layout benefits from a visible separator. Combine it with sufficient column-gap spacing to prevent the line from crowding the content.

Browser Support

The column-rule 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: 1px solid #cccccc;
}

Longhand Equivalent

.article {
  column-rule-width: 1px;
  column-rule-style: solid;
  column-rule-color: #cccccc;
}

Compatibility Considerations

Some older browsers required vendor-prefixed multi-column properties. Current browser versions support the unprefixed syntax.

For current compatibility details, visit Can I Use? and search for column-rule.

Specifications

The column-rule property is defined in CSS Multi-column Layout Module Level 1.

CSS Multi-column Layout Module Level 1

The specification defines the shorthand syntax, its longhand components, and the painting behavior of rules between adjacent columns.