W3cubDocs

/CSS

columns

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).

Syntax

The columns property is specified as one or two of the values listed below, in any order.

Values

<'column-width'>
Is a <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'>
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'>

Example

HTML

<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>

CSS

.content-box {
  columns: 3 auto;
}

Result

Specifications

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

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support

50

50 -webkit-

Yes

Yes -webkit-

52

9 -moz-

10

11.1

15 -webkit-

3 -webkit-
On display: table-caption Yes Yes 37 Yes Yes Yes
Feature Android webview Chrome for Android Edge mobile Firefox for Android Opera Android iOS Safari Samsung Internet
Basic support

Yes

2.1 -webkit-

50

Yes

Yes -webkit-

52

22 -moz-

11.5

32 -webkit-

3.2 -webkit- ?
On display: table-caption Yes ? Yes 37 Yes Yes ?

© 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