CSS column-rule-width Property
The column-rule-width property sets the thickness of the decorative line drawn between adjacent columns in a CSS multi-column layout.
It accepts the keywords thin, medium, and thick, or a non-negative CSS length such as 2px, 0.2rem, or 0.15em.
The property is one of three longhand properties controlled by the column-rule shorthand. A visible column-rule-style must also be specified for the rule to appear.
column-rule-width Syntax
The column-rule-width property accepts a line-width keyword or a non-negative CSS length.
selector {
column-rule-width: 2px;
}
General Syntax
selector {
column-rule-width: <line-width>;
}
Thin Rule
.article {
column-rule-width: thin;
}
Medium Rule
.article {
column-rule-width: medium;
}
Thick Rule
.article {
column-rule-width: thick;
}
Pixel Width
.article {
column-rule-width: 3px;
}
Relative Width
.article {
column-rule-width: 0.2em;
}
Zero Width
.article {
column-rule-width: 0;
}
CSS-Wide Keywords
.article {
column-rule-width: inherit;
}
.article {
column-rule-width: initial;
}
.article {
column-rule-width: unset;
}
.article {
column-rule-width: revert;
}
.article {
column-rule-width: revert-layer;
}
Percentages and negative lengths are not valid values for column-rule-width.
Property Values
The property supports three predefined width keywords and non-negative length values.
| Value | Description |
|---|---|
thin |
Uses a browser-defined thin rule width. |
medium |
Uses a browser-defined medium rule width. This is the initial value. |
thick |
Uses a browser-defined thick rule width. |
2px |
Sets a rule width of 2 CSS pixels. |
0.2rem |
Sets a width relative to the root element's font size. |
0.15em |
Sets a width relative to the element's font size. |
0 |
Sets the rule width to zero. |
calc(1px + 0.1em) |
Uses a calculated length. |
CSS-Wide Keywords
| Value | Description |
|---|---|
inherit |
Uses the computed value from the parent element. |
initial |
Resets the width to medium. |
unset |
Resets the width to its initial value because the property 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 | medium |
| Inherited | No |
| Applies to | Multi-column containers |
| Computed value | Absolute length; 0 when column-rule-style is none or hidden |
| Animation type | By computed value type (length) |
| Percentages | Not accepted |
| Negative values | Not accepted |
| Layout effect | Does not change column widths or gaps |
The width controls the painted thickness of the rule, not the amount of space reserved between columns.
How It Works
The browser determines the column layout and paints rules between adjacent columns using the specified width, style, and color.
Step 1: Create Multiple Columns
.article {
column-count: 3;
}
Step 2: Define Column Spacing
.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;
}
Step 4: Set the Rule Width
.article {
column-count: 3;
column-gap: 30px;
column-rule-style: solid;
column-rule-width: 2px;
}
Step 5: Set the Rule Color
.article {
column-count: 3;
column-gap: 30px;
column-rule-style: solid;
column-rule-width: 2px;
column-rule-color: #777777;
}
Step 6: Paint the Rules
The browser draws a 2-pixel solid gray separator in the center of each gap between adjacent columns.
Important Distinction
The width affects the rule's appearance only. It does not change the number of columns, the column gap, or the order of the content.
thin, medium, and thick
The thin, medium, and thick keywords provide predefined rule widths.
thin
.article {
column-rule-width: thin;
}
The thin keyword requests a narrow separator.
medium
.article {
column-rule-width: medium;
}
The medium keyword is the initial value of the property.
thick
.article {
column-rule-width: thick;
}
The thick keyword requests a wider separator.
Comparing Keyword Widths
.rule-thin {
column-rule: thin solid #777777;
}
.rule-medium {
column-rule: medium solid #777777;
}
.rule-thick {
column-rule: thick solid #777777;
}
Browser-Defined Measurements
The specification does not require fixed pixel measurements for these keywords. Browsers choose their actual widths while maintaining the relative order of thin, medium, and thick.
When to Use Keywords
Use keyword widths when an approximate thickness is sufficient. Use a length value when precise control is required.
Length Values
The column-rule-width property accepts non-negative CSS length values.
Pixels
.article {
column-rule-width: 2px;
}
Pixels provide a predictable CSS measurement for the separator thickness.
rem Units
.article {
column-rule-width: 0.2rem;
}
The rem unit is relative to the root element's font size.
em Units
.article {
column-rule-width: 0.15em;
}
The em unit is relative to the element's font size.
Points
.article {
column-rule-width: 2pt;
}
Points are absolute CSS length units commonly associated with print styling.
Viewport Units
.article {
column-rule-width: 0.2vw;
}
Viewport-relative units can make the rule width change with the viewport, although they may produce impractically thin or thick separators.
Fractional Lengths
.article {
column-rule-width: 1.5px;
}
Fractional lengths are valid. The browser determines how to render the resulting thickness on the device's pixel grid.
When to Use Length Values
Use explicit lengths when the separator must match a defined design measurement or maintain consistent thickness across multiple components.
Zero and Negative Values
Rule widths must be non-negative. A zero width is valid, but negative widths are not.
Zero Width
.article {
column-rule-width: 0;
}
A zero-width rule has no visible thickness, even when its style is solid.
Zero Pixels
.article {
column-rule-width: 0px;
}
This has the same effect as specifying 0.
Negative Width
.article {
column-rule-width: -2px;
}
This declaration is invalid because negative lengths are not permitted.
Percentage Width
.article {
column-rule-width: 10%;
}
This declaration is invalid because percentages are not accepted.
Using none Instead of Zero
.article {
column-rule-style: none;
}
Use column-rule-style: none when the intention is to remove the separator rather than assign it a zero width.
Practical Consideration
When a declaration is invalid, the browser ignores it and determines the property value from other applicable declarations or its initial value.
Rule Style and Visibility
A visible column-rule-style is required for the specified width to produce a visible separator.
Width Without Style
.article {
column-count: 2;
column-rule-width: 4px;
}
No separator appears because the initial value of column-rule-style is none.
Solid Rule
.article {
column-rule-width: 4px;
column-rule-style: solid;
}
Dashed Rule
.article {
column-rule-width: 4px;
column-rule-style: dashed;
}
Dotted Rule
.article {
column-rule-width: 4px;
column-rule-style: dotted;
}
Double Rule
.article {
column-rule-width: 6px;
column-rule-style: double;
}
none and hidden
.article {
column-rule-width: 4px;
column-rule-style: none;
}
The rule is not painted. The computed width is zero when the style is none or hidden.
Double Rule Width
For a double rule, the specified width includes both parallel lines and the space between them.
Rule Color
The column-rule-color property controls the color of the separator independently of its width.
Named Color
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: blue;
}
Hexadecimal Color
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: #336699;
}
RGB Color
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: rgb(51 102 153);
}
Transparent Color
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: rgb(0 0 0 / 30%);
}
currentColor
.article {
color: #333333;
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: currentColor;
}
The currentColor keyword uses the computed text color of the multi-column container.
Width and Color Independence
Changing the color does not change the specified width. A 2-pixel rule remains 2 pixels wide regardless of its color.
column-rule Shorthand
The column-rule shorthand sets the width, style, and color of column separators in a single declaration.
Complete Shorthand
.article {
column-rule: 2px solid #777777;
}
Equivalent Longhand Declarations
.article {
column-rule-width: 2px;
column-rule-style: solid;
column-rule-color: #777777;
}
Changing Only the Width
.article {
column-rule: 2px solid #777777;
column-rule-width: 5px;
}
The later longhand declaration changes the width without resetting the style or color.
Shorthand Reset Behavior
.article {
column-rule-width: 5px;
column-rule-color: red;
column-rule: solid;
}
The shorthand resets the omitted width to medium and the omitted color to currentColor.
Width and Style
.article {
column-rule: 3px dashed;
}
The color uses its initial value of currentColor.
Width Only
.article {
column-rule: 4px;
}
The style resets to none, so no visible rule is drawn.
When to Use the Longhand
Use column-rule-width when the rule's style and color are already defined and only the thickness needs to change.
Column Gap and Positioning
The column-gap property determines the spacing between adjacent columns. The column rule is drawn in the center of that gap.
Basic Example
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid #777777;
}
Increasing Rule Width
.article {
column-count: 3;
column-gap: 30px;
column-rule: 8px solid #777777;
}
The separator becomes thicker, but the column gap remains 30 pixels.
Rule Wider Than Gap
.article {
column-count: 3;
column-gap: 10px;
column-rule: 20px solid #777777;
}
The rule can extend beyond the gap and overlap adjacent content because it does not occupy additional layout space.
Zero Gap
.article {
column-count: 3;
column-gap: 0;
column-rule: 2px solid #777777;
}
The rule can still be painted, but there is no spacing to separate it from the content.
Single Column
.article {
column-count: 1;
column-rule: 5px solid #777777;
}
No separator appears because there are no adjacent columns.
Recommended Spacing
Choose a column gap that provides sufficient space on both sides of the rule, especially when using thicker separators.
Calculated Widths
CSS math functions and custom properties can provide flexible rule widths.
Using calc()
.article {
column-rule-width: calc(1px + 0.1em);
}
The calc() function combines compatible length values into a calculated width.
Using clamp()
.article {
column-rule-width: clamp(1px, 0.2vw, 4px);
}
The clamp() function limits the width to a minimum and maximum value while allowing it to vary between them.
Using max()
.article {
column-rule-width: max(2px, 0.1em);
}
Using min()
.article {
column-rule-width: min(4px, 0.3em);
}
CSS Custom Property
:root {
--column-divider-width: 2px;
}
.article {
column-rule: solid #777777;
column-rule-width: var(--column-divider-width);
}
Component-Specific Width
.article {
--column-divider-width: 3px;
column-rule: var(--column-divider-width) solid #777777;
}
Calculated Width Considerations
The resulting width must be valid for the property. Negative values are not permitted, and percentages cannot be used as column-rule widths.
Responsive Layouts
Column-rule widths can adapt to different screen sizes and multi-column arrangements.
Desktop Layout
.article {
column-count: 3;
column-gap: 30px;
column-rule: 3px solid #777777;
}
Tablet Layout
@media (max-width: 900px) {
.article {
column-count: 2;
column-gap: 24px;
column-rule-width: 2px;
}
}
Mobile Layout
@media (max-width: 600px) {
.article {
column-count: 1;
column-rule-style: none;
}
}
Automatic Column Count
.article {
column-width: 240px;
column-gap: 30px;
column-rule: 2px solid #777777;
}
The browser adjusts the number of columns according to the available space.
Responsive Rule Width
.article {
column-rule: clamp(1px, 0.2vw, 4px) solid #777777;
}
Single-Column Behavior
When only one column is generated, there are no adjacent columns to separate. The rule is not painted, even if its width remains defined.
Practical Consideration
Adjust the column count and gap before increasing rule thickness. Readable column widths are more important than prominent separators.
Practical Uses
Different rule widths can create subtle or prominent separators in multi-column content.
Documentation Columns
.documentation {
column-count: 2;
column-gap: 30px;
column-rule: 1px solid #cccccc;
}
Reference Lists
.reference-list {
column-width: 220px;
column-gap: 25px;
column-rule: 2px dashed #999999;
}
Technical Glossaries
.glossary {
column-count: 3;
column-gap: 30px;
column-rule: 3px dotted #777777;
}
Emphasized Separators
.content {
column-count: 2;
column-gap: 35px;
column-rule: 5px double #555555;
}
Subtle Dividers
.content {
column-count: 2;
column-gap: 30px;
column-rule: 1px solid rgb(0 0 0 / 20%);
}
Theme-Based Widths
.content {
--divider-width: 2px;
column-count: 2;
column-gap: 30px;
column-rule: var(--divider-width) solid #777777;
}
When Not to Use
Do not use column-rule-width to control borders between Grid or Flexbox items. Column rules apply to CSS multi-column layouts.
column-rule-width Example
The following example compares five column-rule widths using the same two-column layout.
Each example uses a solid gray separator and a 30-pixel column gap. Only the width changes.
<div class="column-rule-width-demo">
<div class="rule-example">
<h3>Thin Rule</h3>
<div class="rule-columns thin-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls the presentation of those elements, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>Medium Rule</h3>
<div class="rule-columns medium-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls the presentation of those elements, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>Thick Rule</h3>
<div class="rule-columns thick-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls the presentation of those elements, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>2px Rule</h3>
<div class="rule-columns two-pixel-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls the presentation of those elements, including colors, spacing, and layout.</p>
</div>
</div>
<div class="rule-example">
<h3>6px Rule</h3>
<div class="rule-columns six-pixel-rule">
<p>HTML defines the structure of a web page, including headings, paragraphs, and links.</p>
<p>CSS controls the presentation of those elements, including colors, spacing, and layout.</p>
</div>
</div>
</div>
.column-rule-width-demo {
display: grid;
gap: 20px;
}
.column-rule-width-demo .rule-example {
padding: 15px;
border: 1px solid #cccccc;
background-color: #f8f9fa;
}
.column-rule-width-demo h3 {
margin: 0 0 12px;
font-size: 1.125rem;
}
.column-rule-width-demo .rule-columns {
column-count: 2;
column-gap: 30px;
column-rule-style: solid;
column-rule-color: #666666;
}
.column-rule-width-demo .rule-columns p {
margin: 0;
}
.column-rule-width-demo .thin-rule {
column-rule-width: thin;
}
.column-rule-width-demo .medium-rule {
column-rule-width: medium;
}
.column-rule-width-demo .thick-rule {
column-rule-width: thick;
}
.column-rule-width-demo .two-pixel-rule {
column-rule-width: 2px;
}
.column-rule-width-demo .six-pixel-rule {
column-rule-width: 6px;
}
@media (max-width: 600px) {
.column-rule-width-demo .rule-columns {
column-count: 1;
}
}
Thin Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls the presentation of those elements, including colors, spacing, and layout.
Medium Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls the presentation of those elements, including colors, spacing, and layout.
Thick Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls the presentation of those elements, including colors, spacing, and layout.
2px Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls the presentation of those elements, including colors, spacing, and layout.
6px Rule
HTML defines the structure of a web page, including headings, paragraphs, and links.
CSS controls the presentation of those elements, including colors, spacing, and layout.
The thin, medium, and thick examples use browser-defined widths. Their exact measurements may vary between browsers.
The 2-pixel and 6-pixel examples demonstrate explicit length values, providing more precise control over the separator thickness.
All examples use the same solid style, gray color, and column gap. Only the column-rule-width value changes.
On narrow screens, the media query switches the content to one column, so no separators are displayed.
Accessibility
Column-rule widths can help distinguish adjacent columns, but separators should remain decorative and should not replace meaningful HTML structure.
Use Appropriate Thickness
Choose a width that makes the separator visible without drawing excessive attention away from the text.
Maintain Adequate Spacing
Thick rules can overlap content when the column gap is too narrow. Leave sufficient space on both sides of the separator.
Consider High Zoom Levels
Test multi-column layouts at increased browser zoom levels. Fewer columns may be necessary to preserve readable text widths.
Preserve Semantic Structure
Column rules do not create separate sections or change the document's reading order. Use appropriate HTML headings and elements to organize content.
Avoid Relying on Rule Width Alone
If different rule widths are intended to communicate meaning, provide supporting text or semantic markup.
Forced Colors
Test decorative separators in forced-colors modes, where browser adjustments may change their appearance.
Responsive Reading
Reduce the number of columns when necessary to maintain readable line lengths on smaller screens.
Important Considerations
Keep the following points in mind when using column-rule-width:
- Purpose: Sets the thickness of decorative separators between adjacent CSS columns.
- Initial value:
medium. - Inheritance: The property is not inherited.
- Keyword values:
thin,medium, andthick. - Length values: Non-negative CSS lengths such as
2px,0.2rem, and0.15em. - Keyword measurements: Actual widths are determined by the browser.
- Percentages: Not accepted.
- Negative values: Not accepted.
- Zero width: Produces no visible separator.
- Rule style: A visible
column-rule-styleis required. - Rule color: Controlled separately by
column-rule-color. - Shorthand:
column-rulecan set width, style, and color together. - Shorthand resets: Omitted components return to their initial values.
- Computed width: Becomes zero when the rule style is
noneorhidden. - Position: Rules are centered within column gaps.
- Layout: Rule widths do not affect column widths, gaps, or content flow.
- Wide rules: May extend into adjacent columns if wider than the gap.
- Single column: No separator appears when only one column is generated.
- Calculated values: CSS math functions and custom properties can provide flexible widths.
- Animations: Length values can be interpolated during transitions and animations.
- Accessibility: Maintain adequate spacing, readable columns, and clearly visible separators.
Use column-rule-width when you need to adjust separator thickness without changing its style or color. For a complete separator declaration, use the column-rule shorthand.
Browser Support
The column-rule-width 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-width: 2px;
column-rule-style: solid;
column-rule-color: #777777;
}
Shorthand Equivalent
.article {
column-count: 3;
column-gap: 30px;
column-rule: 2px solid #777777;
}
Compatibility Considerations
Older browsers sometimes required vendor-prefixed multi-column properties. Modern browsers support the standard unprefixed syntax.
For current compatibility details, visit Can I Use? and search for column-rule-width.
Specifications
The column-rule-width property is defined in CSS Multi-column Layout Module Level 1.
CSS Multi-column Layout Module Level 1
The specification defines the accepted width values, initial value, and relationship to the column-rule shorthand.
