column-span
column-span
CSS 属性在设置为 all
时,可以使元素跨越所有列。
试试看
跨越多个列的元素称为跨列元素。
语法
css
/* Keyword values */
column-span: none;
column-span: all;
/* Global values */
column-span: inherit;
column-span: initial;
column-span: revert;
column-span: revert-layer;
column-span: unset;
column-span
属性指定为以下列出的关键字值之一。
Values
正式定义
正式语法
column-span =
none |
all
示例
使标题跨越列
在此示例中,标题跨越文章的所有列。
HTML
html
<article>
<h2>Header spanning all of the columns</h2>
<p>
The h2 should span all the columns. The rest of the text should be
distributed among the columns.
</p>
<p>
This is a bunch of text split into three columns using the CSS `columns`
property. The text is equally distributed over the columns.
</p>
<p>
This is a bunch of text split into three columns using the CSS `columns`
property. The text is equally distributed over the columns.
</p>
<p>
This is a bunch of text split into three columns using the CSS `columns`
property. The text is equally distributed over the columns.
</p>
<p>
This is a bunch of text split into three columns using the CSS `columns`
property. The text is equally distributed over the columns.
</p>
</article>
CSS
css
article {
columns: 3;
}
h2 {
column-span: all;
}
结果
规范
规范 |
---|
CSS 多列布局模块级别 1 # column-span |
浏览器兼容性
BCD 表格仅在浏览器中加载