column-rule
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
The column-rule
shorthand CSS property sets the width, style, and color of the line drawn between columns in a multi-column layout.
Try it
Constituent properties
This property is a shorthand for the following CSS properties:
Syntax
css
column-rule: dotted;
column-rule: solid 8px;
column-rule: solid blue;
column-rule: thick inset blue;
/* Global values */
column-rule: inherit;
column-rule: initial;
column-rule: revert;
column-rule: revert-layer;
column-rule: unset;
Values
The column-rule
property is specified as one, two, or three of the values listed below, in any order.
<'column-rule-width'>
-
Is a
<length>
or one of the three keywords,thin
,medium
, orthick
. Seeborder-width
for details. <'column-rule-style'>
-
See
border-style
for possible values and details. <'column-rule-color'>
-
Is a
<color>
value.
Formal definition
Initial value | as each of the properties of the shorthand:
|
---|---|
Applies to | multicol elements |
Inherited | no |
Computed value | as each of the properties of the shorthand:
|
Animation type | as each of the properties of the shorthand:
|
Formal syntax
column-rule =
<gap-rule-list> |
<auto-gap-rule-list>
<gap-rule-list> =
<gap-rule-or-repeat> [ / <gap-rule-or-repeat> ]*
<auto-gap-rule-list> =
[ [ <gap-rule-or-repeat> ] / ]* <auto-repeat-gap-rule> [ / [ <gap-rule-or-repeat> ] ]*
<gap-rule-or-repeat> =
<gap-rule> |
<repeat-gap-rule>
<auto-repeat-gap-rule> =
repeat( auto , [ <gap-rule> ]# )
<gap-rule> =
<line-width> ||
<line-style> ||
<color>
<repeat-gap-rule> =
repeat( [ <integer [1,∞]> ] , [ <gap-rule> ]# )
<line-width> =
<length [0,∞]> |
thin |
medium |
thick
<line-style> =
none |
hidden |
dotted |
dashed |
solid |
double |
groove |
ridge |
inset |
outset
Examples
Example 1
css
/* Same as "medium dotted currentcolor" */
p.foo {
column-rule: dotted;
}
/* Same as "medium solid blue" */
p.bar {
column-rule: solid blue;
}
/* Same as "8px solid currentcolor" */
p.baz {
column-rule: solid 8px;
}
p.abc {
column-rule: thick inset blue;
}
Example 2
HTML
html
<p class="content-box">
This is a bunch of text split into three columns. Take note of how the
`column-rule` property is used to adjust the style, width, and color of the
rule that appears between the columns.
</p>
CSS
css
.content-box {
padding: 0.3em;
background: #ff7;
column-count: 3;
column-rule: inset 2px #33f;
}
Result
Specifications
Specification |
---|
CSS Multi-column Layout Module Level 1 # column-rule |
Browser compatibility
BCD tables only load in the browser