The columns
CSS property sets the column width and column count of an element.
/* Column width */ columns: 1em; /* Column count */ columns: auto; columns: 1; /* Both column width and count */ columns: 1 auto; columns: auto 12em; columns: auto auto; /* Global values */ columns: inherit; columns: initial; columns: unset;
It is a shorthand property that sets both the column-width
and column-count
properties in a single, convenient declaration.
Note: 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).
The columns
property is specified as one or two of the values listed below, in any order.
<'column-width'>
<length>
value or the keyword auto
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'>
<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.<'column-width'> || <'column-count'>
<p class="content-box"> This is a bunch of text split into three columns using the CSS `columns` property. The text is equally distributed over the columns. </p>
.content-box { columns: 3 auto; }
Specification | Status | Comment |
---|---|---|
CSS Multi-column Layout Module The definition of 'columns' in that specification. | Candidate Recommendation | Initial definition. |
Initial value | as each of the properties of the shorthand:
|
---|---|
Applies to | Block containers except table wrapper boxes |
Inherited | no |
Media | visual |
Computed value | as each of the properties of the shorthand:
|
Animation type | as each of the properties of the shorthand:
|
Canonical order | per grammar |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/columns