試一試
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 |
瀏覽器相容性
載入中…