column-rule
简写
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
,和
column-rule-color
.
注意: 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).
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;
column-rule
property is specified as one, two, or three of the values listed below, in any order.
<'column-rule-width'>
<length>
or one of the three keywords,
thin
,
medium
,或
thick
。见
border-width
了解细节。
<'column-rule-style'>
border-style
for possible values and details.
<'column-rule-color'>
<color>
值。
| 初始值 |
as each of the properties of the shorthand:
|
|---|---|
| 适用于 | multicol elements |
| 继承 | no |
| 计算值 |
as each of the properties of the shorthand:
|
| 动画类型 |
as each of the properties of the shorthand:
|
<'column-rule-width'> || <'column-rule-style'> || <'column-rule-color'>
/* 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; }
<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>
.content-box {
padding: 0.3em;
background: #ff7;
column-count: 3;
column-rule: inset 2px #33f;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Multi-column Layout Module
The definition of 'column-rule' in that specification. |
工作草案 | 初始定义。 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
column-rule
|
Chrome 完整支持 50 | Edge 完整支持 12 |
Firefox
完整支持
52
|
IE 完整支持 10 | Opera 完整支持 11.1 | Safari 完整支持 9 | WebView Android 完整支持 50 | Chrome Android 完整支持 50 |
Firefox Android
完整支持
52
|
Opera Android 完整支持 11.1 | Safari iOS 完整支持 9 | Samsung Internet Android 完整支持 5.0 |
完整支持
见实现注意事项。
要求使用供应商前缀或不同名称。