CSS columns: responsive multi-column text
To flow one article through multiple columns, set CSS columns on its container. columns: 200px 3 fits as many 200px columns as space allows, up to three. Narrowing the container reduces the number of columns while preserving the text order.
Set the column width and count
.text-a { columns: 3; }
.text-b { columns: 200px; }
.text-c { columns: 200px 3; }
columns: 3 divides the available width into three columns. columns: 200px calculates the count from the preferred width and the gap. Set both values to cap the count. Extra width is shared across the columns, so actual widths can exceed 200px. If the container itself is narrower, one column fills the available width. See CSS Multicol · Column Width and Count.
Run an example that changes the column count
Save the example as columns.html and open it. No other files are required. Change the available width and read down each column before returning to the top of the next one.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Text flowing between columns</title>
<style>
body { margin: 20px; font: 16px/1.6 system-ui, sans-serif; color: #203348; }
* { box-sizing: border-box; }
h1 { font-size: 24px; }
.article { max-width: 900px; columns: 200px 3;
column-gap: 24px; column-rule: 1px solid #9db7c8; }
.article p { margin: 0 0 1em; }
.note { padding: 12px; border: 1px solid #84b8c0;
background: #e5f5f4; break-inside: avoid; }
</style>
</head>
<body>
<h1>Column count changes with width</h1>
<article class="article">
<p><strong>First paragraph.</strong> A multi-column layout flows one article through several columns. Read down one column and pick up at the top of the next. The text continues in the order it appears in the document.</p>
<p><strong>Second paragraph.</strong> The preferred width is 200px with a cap of three columns. A wide window can show all three. When the window narrows, fewer columns share the available width.</p>
<p><strong>Third paragraph.</strong> There is a 24px gap between columns. The thin rule is drawn within that gap. Change the width to see where the lines and columns break.</p>
<aside class="note">This note uses break-inside: avoid to stay together when it fits. A note that exceeds the available space may need to break or overflow.</aside>
<p><strong>Final paragraph.</strong> The reading order follows the HTML. The layout has no fixed height, so more text can make it taller. One column can be easier to read if a long article requires scrolling back up to start each column.</p>
</article>
</body>
</html>
Three columns need three widths of 200px plus two 24px gaps, or 648px of content width. Two need 424px. Below 424px, the example has one column. From 424px to just under 648px it has two. Measure the article’s content width, which excludes the page margins.
Keep the cap at three and change only column-gap from 24px to 40px. Three columns now need 680px instead of 648px. At 660px the count drops from three to two. Restore 24px after comparing. column-rule draws a divider inside the gap, so its thickness adds no width to the calculation.
Adjust gaps, breaks, and headings that span columns
The example applies break-inside: avoid to keep the note together where possible. A note that cannot fit in a column may still split or overflow. Resize an oversized image or allow long URLs to wrap as needed. See CSS Fragmentation · Breaks Within Boxes for the break rules.
To try the optional rules, add the CSS below and insert an h2 inside the article. With column-span: all, it spans every column. Add a figure to apply the break-avoidance rule, or add new-column to a paragraph to force a break before it in a multi-column layout. See CSS Multicol · Spanning Columns.
.article h2 {
column-span: all;
}
.article figure {
break-inside: avoid;
}
.article .new-column {
break-before: column;
}
Choose a layout for long text or independent items
A fixed height can make extra columns run off to the right. Start with automatic height for an article and check the way the browser balances column endings. If readers must scroll a long way back up to reach each next column, use one column.
Use multi-column layout for a continuous document. Use Grid or Flexbox when independent items, such as cards or a main section and sidebar, need predictable positions.




