CSS column-rule
Property
The column-rule
property in CSS is a shorthand property used to set the width, style, and color of the vertical rule (divider) between columns in a multi-column layout. It combines the functionality of column-rule-width
, column-rule-style
, and column-rule-color
into a single property.
1. Syntax
Value | Description |
---|---|
width | The width (thickness) of the column rule (e.g., 3px ). |
style | The style of the column rule (e.g., solid , dashed ). |
color | The color of the column rule (e.g., black , red ). |
2. Example – Basic Usage of column-rule
✅ Adds a 3px dashed blue rule between the columns.
3. Example – Using column-rule
with column-count
✅ Displays a 4px solid black divider between the columns.
4. Example – Full Shorthand with column-rule
✅ Equivalent to:
5. Best Practices
✔ Use column-rule
for compact code.
✔ Always pair with column-count
or column-width
for a multi-column layout.
✔ Make sure the rule is subtle (avoid too thick or distracting lines).