Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

Summary

The columns CSS property is a shorthand property allowing to set both the column-width and the column-count properties at the same time.

Initial valueas each of the properties of the shorthand:
Applies tonon-replaced block elements (except table elements), table-cell or inline-block elements
Inheritedno
Mediavisual
Computed valueas each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:
Canonical orderorder of appearance in the formal grammar of the values

Syntax

columns: 1em;
columns: 1;
columns: auto;
columns: 1 auto;
columns: auto 12em;
columns: auto auto;

Values

<'column-width'>
Is a <length> value giving a hint of the optimal width of the column. The actual column width may be wider (to fill the available space), or narrower (only if the available space is smaller than the specified column width). The length must be strictly positive or the declaration is invalid.
<'column-count'>
Is a strictly positive <integer> describing the ideal number of columns into which the content of the element will be flowed. If the column-width is also set to a non-auto value, it merely indicates the maximum allowed number of columns.

Formal syntax

<'column-width'> || <'column-count'>

Examples

.content-box {
  border: 10px solid #000000;
  columns:3;
}

Specifications

Specification Status Comment
CSS Multi-column Layout Module
The definition of 'columns' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) -webkit
50.0
9 (9) -moz 10 11.10
15 -webkit
3.0 (522)-webkit
on display: table-caption (Yes) 37 (37) (Yes) (Yes) (Yes)
Feature Android Android Webview Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support 2.1 -webkit 50.0 22.0 (22) -moz 10 11.5
32 -webkit
3.2 -webkit 50.0
on display: table-caption (Yes) ? 37.0 (37) (Yes) (Yes) (Yes) ?

See also

文件標籤與貢獻者

 最近更新: Sebastianz,