column-rule 5g6655
The column-rule property is used to draw a rule, kind of like a border, between adjacent columns in a multi-column layout. 266b3q
It is a shorthand property used to set the longhand column rule properties.
A column rule can be styled, colored, and have a specified width. This can be done using the longhand properties: column-rule-color
.
A column rule is drawn only between adjacent columns; that is, it is not drawn before the first column, nor is it drawn after the last column.
A column rule does not take up any space. This means that adding a column rule will not increase the amount of space, or the column-gap
), between the columns.
Official Syntax 4j1l4a
- Syntax:
column-rule: <"column-rule-width"> || <"column-rule-style"> || <"column-rule-color">
- Initial: 0 solid currentColor; which is the concatenation of the initial values of each of the longhand properties
- Applies To: multi-column elements
- Animatable: the
column-rule-color
property is animatable as a color
Values 4w6m73
- <‘column-rule-width’> || <‘column-rule-style’> || <‘column-rule-color’>
-
See the
column-rule-color
entries for more information on possible values for each property.
Notes 5i3os
Omitted values are set to their initial values. That is, if you only specify values for one or two properties in the shorthand column-rule
property, the property or properties whose values are not specified are set to their initial values.
Examples 3y6d6i
The following rule:
column-rule: 1em dotted #ddd;
is equivalent to:
column-rule-width: 1em; column-rule-style: dotted; column-rule-color: #ddd;
The following draws a green dashed rule between adjacent columns in a multi-column element:
.el { columns: 12em 3; column-rule: 2px dashed #009966; }
The following example applies a column rule which spans across and fills the entire space between adjacent columns, because the width of the rule is equal to the width of the column-gap
:
.mag { column-width: 25%; column-rule: 20px solid gray; column-gap: 20px; }
Live Demo 176n59
Play with the values of the column-rule
property and the column-gap
properties to see how the rules between the columns are drawn.
Browser s162l
CSS3 Multiple column layout 1x2y3u
Method of flowing information in multiple columns
W3C Candidate Recommendation
ed from the following versions:
Desktop 1i5h4c
- 50
- 52
- 10
- 11
- 10
Mobile / Tablet 1u2r2g
- 10
- 66
- all
- 66
- 60