CKTIS / CSS
column-count — number of columns
The column-count property specifies the target number of columns through which content flows. When column-width is also set, that number acts as an upper limit in layout calculations.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
column-count: auto | <integer [1,∞]>;In a multi-column layout, content flows continuously down one column and then into the next, rather than occupying independent grid cells.
The initial value of column-count is auto. If both column-count and column-width are auto, these properties do not establish a multi-column container. If only column-count is auto, the count is calculated from column-width and the available space. An integer must be positive; 0, negative numbers, and fractions are invalid. The property is not inherited and applies to block containers except table wrapper boxes.
When column-count is a positive integer and column-width is auto, column widths adapt to the available space and column-gap. When both properties have non-auto values, column-count caps the count determined by the available space. It does not guarantee the number of columns actually displayed: forced breaks and height constraints can change that number.
In the example, the three columns are each 120px wide: (420px - 2 * 30px) / 3. column-fill: balance balances their content. The output field shows the expected layout; the example requires local verification.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>column-count</title>
<style>
.columns {
width: 420px;
column-count: 3;
column-width: auto;
column-gap: 30px;
column-fill: balance;
direction: ltr;
writing-mode: horizontal-tb;
font: 16px/20px monospace;
}
</style>
<div class="columns">A<br>B<br>C<br>D<br>E<br>F</div>
</html>Result
A C E B D F
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.