Tag column-rule

When displaying content in multiple columns (like a magazine or newspaper layout), adding a vertical line between columns can improve readability and structure. That’s exactly what the column-rule property does in CSS — it draws a visual separator between columns.


🧾 What is column-rule?

The column-rule property is a shorthand that sets the widthstyle, and color of the line (rule) between columns in a multi-column layout.

It acts like a vertical border but only between columns — not on the outer edges.


🧬 Syntax

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

Components:

PartDescriptionExample
widthThickness of the rule line1px3px
styleLine style (like a border)soliddashed
colorColor of the ruleblack#cccrgba(...)

🎯 Examples

1. Solid black rule

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

This creates a 2px solid black line between the two columns.


2. Dashed colored rule

.content {
column-count: 3;
column-rule: 1px dashed #00aaff;
}

Applies a dashed light blue line between three columns.


3. Use longhand properties (alternative)

.columns {
column-count: 2;
column-rule-width: 3px;
column-rule-style: dotted;
column-rule-color: red;
}

Same result as using shorthand, but with more control or conditional styling.


🧠 How It Works

  • The rule appears between columns only — not on the sides of the container.
  • If there’s only one column, the rule is not displayed.
  • Can be combined with column-gap to set spacing and rule width appropriately.

🛠️ Tips & Best Practices

  • Ensure the rule has good contrast for accessibility.
  • Avoid overly thick or busy rule styles — they can distract from the content.
  • Use transparent or soft-colored rules for a subtle effect.
  • Don’t forget to set column-count or column-width — column-rule won’t work on its own.

✅ Browser Support

column-rule is supported across all modern browsers:

  • ✅ Chrome
  • ✅ Firefox
  • ✅ Safari
  • ✅ Edge
  • ✅ Opera
  • ✅ Internet Explorer 10+ (with limited styling support)

🔚 Conclusion

The CSS column-rule property adds a professional, clean visual divider between columns in multi-column layouts. Whether subtle or bold, it helps readers navigate content with ease.