CSS Multiple Columns
The multi-column layout flows text into several columns, like a newspaper. Content fills the first column, then continues at the top of the next. It's ideal for long text, lists of links and tag clouds — not for page layout (use Grid for that).
Creating columns
There are two ways to say how many columns you want:
| Property | Meaning |
|---|---|
column-count: 3 |
Exactly three columns, whatever the width |
column-width: 140px |
As many columns as fit, each at least ~140px wide |
columns: 140px 3 |
Shorthand: width and/or count (at most 3 columns of ≥140px) |
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: Georgia, serif; font-size: 14px; line-height: 1.5; }
.news { column-count: 3; background: #fffde7; padding: 10px; }
</style>
</head>
<body>
<div class="news">
The town council met on Tuesday evening to discuss the new bicycle lanes planned for the river road. Residents filled the hall, and many asked questions about parking and safety near the school. The mayor promised that construction would happen during the summer holidays to reduce disruption. Shop owners on the high street were mostly positive, hoping that more cyclists would mean more visitors stopping by. A final vote is expected next month after a second round of public comments.
</div>
</body>
</html>Tip:
column-widthis responsive for free: resize the playground in the next example and the number of columns changes automatically, with no media queries.
Gap and rule
| Property | Meaning |
|---|---|
column-gap |
Space between columns (default about 1em) |
column-rule-style |
Line style between columns: solid, dotted, dashed… |
column-rule-width |
Thickness of the line |
column-rule-color |
Colour of the line |
column-rule |
Shorthand: 2px dashed #ccc |
The rule is drawn in the middle of the gap and takes no space.
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
.text {
column-width: 130px;
column-gap: 30px;
column-rule: 3px dotted #ab47bc;
}
</style>
</head>
<body>
<div class="text">
Columns created with column-width adapt to the available space. On a wide screen you might see four columns; on a phone only one. The dotted purple rule between them sits right in the middle of the thirty pixel gap. Rules never change the width of the columns themselves. This makes multi-column layout a quick way to make long lists or paragraphs easier to scan without writing any extra breakpoints.
</div>
</body>
</html>Spanning and breaking
column-span: all lets an element (usually a heading) stretch across every column. break-inside: avoid stops an item from being split between two columns — essential for cards.
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: system-ui, sans-serif; font-size: 14px; }
.wrap { columns: 3; column-gap: 12px; }
h3 { column-span: all; margin: 0 0 8px; padding: 6px; background: #00897b; color: white; text-align: center; }
.card { break-inside: avoid; background: #e0f2f1; border-radius: 8px; padding: 8px; margin: 0 0 10px; }
.tall { height: 70px; }
</style>
</head>
<body>
<div class="wrap">
<h3>Heading spanning all columns</h3>
<div class="card">Card A</div>
<div class="card tall">Card B (tall)</div>
<div class="card">Card C</div>
<div class="card tall">Card D (tall)</div>
<div class="card">Card E</div>
<div class="card">Card F</div>
<div class="card tall">Card G (tall)</div>
</div>
</body>
</html>This is also a simple "masonry" layout: items of different heights stack in columns without big gaps. Note that the order runs down each column, not across rows.
Balancing and fill
By default, columns are balanced to have roughly equal height. If the container has a fixed height, column-fill: auto fills columns one after another instead.
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: system-ui, sans-serif; font-size: 14px; display: flex; gap: 14px; }
ul { columns: 2; height: 160px; margin: 0; padding: 8px 8px 8px 28px; flex: 1; border: 2px solid #90a4ae; }
.balance { column-fill: balance; }
.auto { column-fill: auto; }
</style>
</head>
<body>
<ul class="balance"><li>Apple</li><li>Banana</li><li>Cherry</li><li>Date</li><li>Elderberry</li><li>Fig</li></ul>
<ul class="auto"><li>Apple</li><li>Banana</li><li>Cherry</li><li>Date</li><li>Elderberry</li><li>Fig</li></ul>
</body>
</html>The left list splits 3 + 3; the right one fills the first column top to bottom before starting the second.
When to use multi-column
- ✅ Long text on wide screens, link lists in a footer, tag clouds, simple masonry.
- ❌ Page structure (header, sidebar, main) — readers would have to scroll up and down between columns. Use Grid or Flexbox.
Test yourself
Which property creates as many columns as fit, each at least 200px wide?
- column-count: 200px
- column-width: 200px
- column-gap: 200px
- column-span: 200px
How do you make a heading stretch across all columns?
- column-span: all
- width: 100%
- column-count: 1
- grid-column: 1 / -1
Which declaration prevents a card from being split between two columns?
- break-inside: avoid
- column-break: none
- overflow: hidden
- display: block