试一试
column-count: 2;
column-count: 3;
column-count: 4;
column-count: auto;
column-width: 8rem;
<section id="default-example">
<p id="example-element">
London. Michaelmas term lately over, and the Lord Chancellor sitting in
Lincoln's Inn Hall. Implacable November weather. As much mud in the streets
as if the waters had but newly retired from the face of the earth, and it
would not be wonderful to meet a Megalosaurus, forty feet long or so,
waddling like an elephantine lizard up Holborn Hill.
</p>
</section>
#example-element {
width: 100%;
text-align: left;
}
语法
css
/* Keyword value */
column-count: auto;
/* <integer> value */
column-count: 3;
/* Global values */
column-count: inherit;
column-count: initial;
column-count: revert;
column-count: revert-layer;
column-count: unset;
值
auto-
列的数量由其他 CSS 属性决定,例如
column-width。 <integer>-
一个严格正的
<integer>,描述了元素内容将流入的理想列数。如果column-width也被设置为非auto值,它仅表示允许的最大列数。
正式定义
正式语法
column-count =
auto |
<integer [1,∞]>
示例
将一个段落拆分为三列
HTML
html
<p class="content-box">
This is a bunch of text split into three columns using the CSS
<code>column-count</code>
property. The text is equally distributed over the columns.
</p>
CSS
css
.content-box {
column-count: 3;
}
结果
规范
| 规范 |
|---|
| CSS Multi-column Layout Module Level 1 # cc |
浏览器兼容性
加载中…