The column-rule
shorthand CSS property sets the width, style, and color of the line drawn between columns in a multi-column layout.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
It is a shorthand property that sets the individual column-rule-*
properties in a single, convenient declaration: column-rule-width
, column-rule-style
, and column-rule-color
.
Note: As with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values previously set using non-shorthand properties).
Syntax
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: unset;
The column-rule
property is specified as one, two, or three of the values listed below, in any order.
Values
<'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-width'> || <'column-rule-style'> || <'column-rule-color'>
Examples
Example 1
/* 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
<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
.content-box {
padding: 0.3em;
background: #ff7;
column-count: 3;
column-rule: inset 2px #33f;
}
Result
Specifications
Specification | Status | Comment |
---|---|---|
CSS Multi-column Layout ModuleThe definition of 'column-rule' in that specification. | Working Draft | Initial definition. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
column-rule
|
Chrome Full support 50 Full support 50 Full support 1 Prefixed' Implemented with the vendor prefix: -webkit- |
Edge Full support 12 Full support 12 Full support 12 Prefixed' Implemented with the vendor prefix: -webkit- |
Firefox Full support 52 Full support 52 No support 3.5 — 74 Prefixed' Implemented with the vendor prefix: -moz-
Notes' Before Firefox 3, the default value for the |
IE
Full support 10 |
Opera Full support 11.1 Full support 11.1 Full support 15 Prefixed' Implemented with the vendor prefix: -webkit- |
Safari Full support 9 Full support 9 Full support 3 Prefixed' Implemented with the vendor prefix: -webkit- |
WebView Android Full support 50 Full support 50 Full support ≤37 Prefixed' Implemented with the vendor prefix: -webkit- |
Chrome Android Full support 50 Full support 50 Full support 18 Prefixed' Implemented with the vendor prefix: -webkit- |
Firefox Android Full support 52 Full support 52 Full support 4 Prefixed' Implemented with the vendor prefix: -moz- |
Opera Android Full support 11.1 Full support 11.1 Full support 14 Prefixed' Implemented with the vendor prefix: -webkit- |
Safari iOS Full support 9 Full support 9 Full support 1 Prefixed' Implemented with the vendor prefix: -webkit- |
Samsung Internet Android Full support 5.0 Full support 5.0 Full support 1.0 Prefixed' Implemented with the vendor prefix: -webkit- |
Legend
- Full support
- Full support
- See implementation notes.'
- See implementation notes.
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
column-rule by Mozilla Contributors is licensed under CC-BY-SA 2.5.