Skip to main content

Tailwind CSS Columns Cheatsheet

Create newspaper-style multi-column layouts with Tailwind CSS.
Click any class to copy it to your clipboard.

What are CSS Columns?

CSS columns allow you to create multi-column layouts where content flows automatically from one column to the next, similar to newspaper or magazine layouts. Unlike CSS Grid, which requires explicit placement, columns let content flow naturally across the available space.

Columns Count - Visual Demo

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident. Sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
columns-3

Columns (by count)

ClassCSS
columns-1columns: 1;
columns-2columns: 2;
columns-3columns: 3;
columns-4columns: 4;
columns-5columns: 5;
columns-6columns: 6;
columns-7columns: 7;
columns-8columns: 8;
columns-9columns: 9;
columns-10columns: 10;
columns-11columns: 11;
columns-12columns: 12;
columns-autocolumns: auto;

Column Width - Auto Column Count

When you set a column width, the browser automatically creates as many columns as fit.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
columns-sm (24rem)

Columns (by width)

ClassCSS
columns-3xscolumns: 16rem; /* 256px */
columns-2xscolumns: 18rem; /* 288px */
columns-xscolumns: 20rem; /* 320px */
columns-smcolumns: 24rem; /* 384px */
columns-mdcolumns: 28rem; /* 448px */
columns-lgcolumns: 32rem; /* 512px */
columns-xlcolumns: 36rem; /* 576px */
columns-2xlcolumns: 42rem; /* 672px */
columns-3xlcolumns: 48rem; /* 768px */
columns-4xlcolumns: 56rem; /* 896px */
columns-5xlcolumns: 64rem; /* 1024px */
columns-6xlcolumns: 72rem; /* 1152px */
columns-7xlcolumns: 80rem; /* 1280px */

Break Inside - Keep Elements Together

Use break-inside-avoid to prevent elements from being split across columns.

Card 1

This is some content that belongs together. With break-inside-avoid, this card won't be split across columns.

Card 2

This is some content that belongs together. With break-inside-avoid, this card won't be split across columns.

Card 3

This is some content that belongs together. With break-inside-avoid, this card won't be split across columns.

Card 4

This is some content that belongs together. With break-inside-avoid, this card won't be split across columns.

Card 5

This is some content that belongs together. With break-inside-avoid, this card won't be split across columns.

break-inside-avoid

Break After Column - Force Column Break

Use break-after-column to force the next element to start in a new column.

Section 1

This section has break-after-column

Section 2

Starts in new column

Section 3

Flows normally

Break After

ClassCSS
break-after-autobreak-after: auto;
break-after-avoidbreak-after: avoid;
break-after-allbreak-after: all;
break-after-avoid-pagebreak-after: avoid-page;
break-after-pagebreak-after: page;
break-after-leftbreak-after: left;
break-after-rightbreak-after: right;
break-after-columnbreak-after: column;

Break Before

ClassCSS
break-before-autobreak-before: auto;
break-before-avoidbreak-before: avoid;
break-before-allbreak-before: all;
break-before-avoid-pagebreak-before: avoid-page;
break-before-pagebreak-before: page;
break-before-leftbreak-before: left;
break-before-rightbreak-before: right;
break-before-columnbreak-before: column;

Break Inside

ClassCSS
break-inside-autobreak-inside: auto;
break-inside-avoidbreak-inside: avoid;
break-inside-avoid-pagebreak-inside: avoid-page;
break-inside-avoid-columnbreak-inside: avoid-column;

Practical Examples

Masonry-Like Layout with Columns

CSS columns can create a masonry-like effect where items of different heights flow naturally.

Short
Tall
Medium
Short
Tall
Short
Medium
Medium
<div class="columns-3 gap-4">
  <div class="break-inside-avoid mb-4">Item 1</div>
  <div class="break-inside-avoid mb-4">Item 2</div>
  <!-- ... -->
</div>

Text Columns - Magazine/Newspaper Style

Perfect for long-form content that needs to be displayed in a newspaper-style layout.

The Art of Typography

Typography is the art and technique of arranging type to make written language legible, readable, and appealing when displayed. The arrangement of type involves selecting typefaces, point sizes, line lengths, line-spacing, and letter-spacing.

Good typography establishes a strong visual hierarchy, provides a graphic balance to the website, and sets the product's overall tone. It guides and informs users, optimizes readability and accessibility.

The history of typography began with the invention of movable type in the mid-15th century by Johannes Gutenberg. His printing press revolutionized the production of books and made knowledge more accessible.

Today, web typography has become increasingly important as designers work to create beautiful, readable experiences across all devices and screen sizes.

<article class="columns-2 md:columns-3 gap-6">
  <p>First paragraph...</p>
  <p>Second paragraph...</p>
  <!-- Content flows automatically -->
</article>

Columns vs Grid: When to Use Each

CSS Columns

  • +Best for flowing text content
  • +Automatic content distribution
  • +Great for masonry-like layouts
  • +Newspaper/magazine style layouts
  • -Less control over item placement
  • -Items can break across columns

CSS Grid

  • +Precise two-dimensional control
  • +Explicit row and column placement
  • +Complex layouts with spanning
  • +Best for UI components/layouts
  • -More verbose for simple flows
  • -Items don't flow automatically

Rule of thumb: Use columns for flowing content (text, cards that should fill space), use grid for structured layouts where you need precise control.

Common Column Patterns

Responsive Columns

<div class="columns-1 md:columns-2 lg:columns-3">
  <!-- Content flows across columns -->
</div>

Card Masonry

<div class="columns-3 gap-4">
  <div class="break-inside-avoid mb-4">
    Card content
  </div>
</div>

Article Text

<article class="columns-2 gap-8">
  <p>Paragraph 1...</p>
  <p>Paragraph 2...</p>
</article>

Width-Based Columns

<div class="columns-xs gap-6">
  <!-- Auto column count based on
       20rem min width -->
</div>

Column Gap

Use the gap-* utilities to control the space between columns. See the spacing reference for all values.

gap-416px (1rem)
gap-624px (1.5rem)
gap-832px (2rem)
gap-1248px (3rem)

Frequently Asked Questions

What are CSS columns in Tailwind?

Tailwind's column utilities control the CSS multi-column layout, which automatically flows content across multiple columns like newspaper-style layouts. Use columns-2, columns-3, etc. to set the number of columns.

What is the difference between columns and grid in Tailwind?

CSS Grid creates a two-dimensional layout with explicit rows and columns, while CSS columns create a newspaper-style flow where content automatically moves to the next column. Grid is better for structured layouts, columns is better for flowing text content.

How do I prevent elements from breaking across columns?

Use break-inside-avoid to prevent an element from being split across columns. For cards, images, or grouped content, this keeps them intact within a single column.

Can I set column width instead of column count?

Yes! Tailwind provides column width utilities like columns-xs (20rem), columns-sm (24rem), columns-md (28rem), etc. The browser will automatically create as many columns as fit within the container.