CSS Reference ยท Multi-column and Fragmentation
The column-fill property
Reference for the CSS column-fill property: choose whether columns are balanced to equal height or filled in order up to a fixed height, with an example.
The column-fill property decides how content is distributed between columns. With balance (the default) the browser makes the columns about the same height. With auto it fills each column fully before starting the next, which only looks different when the container has a constrained height.
CSS
.box { height: 12rem; column-count: 3; column-fill: auto; }
Try it
Syntax
CSS
column-fill: balance | balance-all | auto;
- Initial value:
balance - Applies to: multi-column containers
- Inherited: no
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
balance |
Columns are made as equal in height as possible. In paged media, only the last fragment is balanced. |
auto |
Fill columns in order; each column takes as much as fits within the container's height. |
balance-all |
In fragmented contexts, balance every fragment. Newer and not widely supported. |
Usage notes
- No height, no difference. If the container height is
auto,column-fill: autoalso balances, because there is no limit to fill up to. - Use
autowith a fixed height when you want text to run left to right through boxes of identical height, as in an article layout over a set area. - Overflow: in a fixed-height container, text that doesn't fit creates extra columns to the right (inline overflow). Avoid this on narrow screens.
- Don't rely on
balance-all; browser support is limited, so check before using it.
Browser support
balance and auto work in all current browsers. balance-all has limited support.
Related
columns- the shorthandcolumn-count- number of columnscolumn-span- spanning elements- Lesson: Multi-column Layout