Multi-Column Layout

Intermediate · 9 min

How column-count and column-width flow content into newspaper-style columns, how to control breaks and spanning, and why a fixed height spills columns.

Before thisSubgrid

Kevin Powell · 9 min

Multi-Column Layout

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Kevin PowellReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • Multicol flows one stream of content down a column, then into the next, the way a newspaper does. It is different from flex and grid, which place separate items.
  • `column-width` is the ideal minimum column width and the browser picks as many columns as fit. `column-count` fixes the number. If you set both, `column-count` becomes a maximum.
  • `column-gap` and `column-rule` space and divide the columns. The rule is drawn in the middle of the gap and takes no space.
  • `column-span: all` makes an element (usually a heading) cut across every column. `break-inside: avoid` stops a card or figure being split between two columns.
  • Columns are balanced by default, so they end up roughly the same height. Give the container a fixed height with `column-fill: auto` and the extra columns overflow to the side.

A different kind of layout

Flexbox and grid both take a set of separate items and arrange them. Multi-column layout is for a single flow of content. You give a container a number of columns, and the content runs down the first one, continues at the top of the second, and so on. It is how newspaper articles work, and it is the one CSS layout mode where the browser decides where to cut your content.

.article { column-width: 18rem; column-gap: 2rem; }

Column count and width

There are two ways to say how many columns you want:

  • column-count: 3 asks for exactly three columns.
  • column-width: 18rem asks for columns at least that wide, and the browser fits as many as it can.

The second is the useful one for responsive design. A container that is wide gets more columns and a narrow one gets fewer, down to one, without a media query. In a 700px container with a 200px width and the default gap, a browser made three columns of about 222.7px each.

You can set both. Then the count acts as a ceiling and the width as a floor. A 700px container with column-count: 3; column-width: 300px got two columns of 342px, because three 300px columns would not fit. The columns shorthand takes one or both: columns: 3 200px.

Gaps and rules

The default column-gap is 1em. Change it to taste. A column-rule draws a line down the middle of each gap, with the same syntax as a border:

.article { columns: 3; column-gap: 40px; column-rule: 1px solid #ccc; }

The rule does not take up space of its own, so adding it doesn’t narrow the columns. It sits in the gap you already made.

Spanning and breaking

Two properties handle the places where the stream shouldn’t just flow.

column-span: all lets one element, usually a heading, stretch across every column. Content before it is balanced into columns, the element sits full-width, and a new set of columns starts after it. In a test, three items and a spanning heading and three more items gave a row of three columns, a 700px-wide heading below it and then another row of three.

.article h2 { column-span: all; }

break-inside: avoid keeps a block in one piece. Without it, a card or image with a caption can be split across two columns, which looks like a bug:

.article figure, .article .card { break-inside: avoid; }

break-before and break-after let you force or forbid a break at a specific point. The same properties apply when printing, which is the subject of print stylesheets.

Balancing and the fixed-height trap

By default (column-fill: balance), the browser spreads content so the columns are about equal in height. That is why a short article with no height set looks tidy.

If you give the container a fixed height, columns fill to that height and then the browser starts a new one. With nothing else limiting the width, the new columns appear off to the side. In a test, a container with height: 80px; columns: 3; column-fill: auto that held six 50px blocks produced six columns, three of them past the container’s 700px edge. The usual fix is to avoid setting a height, or to set max-height only where you mean to create a horizontal scroller.

When to choose multicol

Multicol suits long lists, glossaries, link directories and body text on wide screens. It does not suit a set of cards that need to line up, since each item is placed by the content stream and not by a track. It also has a reading-order cost: users have to scroll down one column and back up to the next, so very tall columns are hard to read. Short, balanced columns are fine.

Support is excellent. Basic multicol has been available in every major browser since 2017, and column-span since 2020.

What the video covers

Kevin Powell’s “The most underappreciated CSS property” is from March 2018, about nine minutes, so it is the oldest pick in this group. The title does not mention columns, but the description says it is about CSS columns and creating multi-column responsive layouts without media queries. It names column-count and column-width as the two main properties and also looks at column-rule, column-gap and the columns shorthand. These properties haven’t changed. I could not read a transcript. The spanning, breaking and fixed-height material above is the prose’s own. For a modern deep dive, the runner-up is Rachel Andrew’s 55-minute CSS Day 2025 talk on multicol and fragmentation, which has no chapters, so it is a talk to watch rather than a lookup.

Where this fits

Multicol is a third layout mode alongside flexbox and grid, and the next lesson, choosing between flexbox and grid, compares the main two. Fixed-height behaviour touches overflow, and column-width gives a taste of the width-driven approach in intrinsic and fluid layouts.

Check yourself

  1. 01What's the difference between `column-count: 3` and `column-width: 200px`?

    `column-count: 3` always makes three columns, however narrow. `column-width: 200px` means "columns about this wide or wider", and the browser fits as many as it can, so the column count changes with the container. In a 700px container with the default gap, `column-width: 200px` gave three columns of about 223px.

  2. 02A card in a multi-column layout is split, with its heading in one column and its text in the next. How do you stop it?

    Set `break-inside: avoid` on the card. The browser then moves the whole card to the next column instead of breaking inside it.

  3. 03You set `height: 300px` on a multicol container and text now runs off to the right in extra columns. Why?

    Columns are filled to the container's height, and content that doesn't fit creates new columns beyond the container's right edge instead of overflowing downward. With auto height the browser balances the content across the columns, so this doesn't happen.

  4. 04When would you use multicol instead of grid?

    When the content is one flowing stream that should break across columns on its own, like a long list, a glossary or text that wraps to fit the width. Use grid when you are placing distinct components in specific cells.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark