CSS Reference ยท Multi-column and Fragmentation
The column-count property
Reference for the CSS column-count property: set how many columns text and content flow into, how it interacts with column-width, with examples.
The column-count property sets the number of columns an element divides its content into. The browser balances the content across them and shares the available width after subtracting the gaps.
CSS
.list { column-count: 2; column-gap: 1.5rem; }
Try it
Syntax
CSS
column-count: auto | <integer>;
- Initial value:
auto - Applies to: non-replaced block containers (except table wrappers), flex containers and grid containers
- Inherited: no
- Animatable: yes, as an integer
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
The number of columns is determined by other properties such as column-width; with neither set there is one column. |
<integer> |
A whole number greater than 0: the number of columns, or the maximum when column-width is also set. |
Usage notes
- With
column-widthit is a maximum.column-count: 4; column-width: 15remcan produce fewer than 4 columns in narrow containers, which makes the layout responsive. - Alone it is fixed.
column-count: 3stays three columns even on a phone, giving very narrow text. Pair it with a media query or usecolumn-widthinstead. - Zero and negative values are invalid.
- Content is balanced by default (see
column-fill), so columns end at roughly the same height. - Lists: a long
ulof short words works very well with columns; addbreak-inside: avoidto list items that wrap. - Accessibility: on screens, users must scroll vertically to read all columns top to bottom, which suits short content only.
Browser support
Supported in all current browsers.
Related
columns- the shorthandcolumn-width- the ideal widthcolumn-gap- the space between columns- Lesson: Multi-column Layout