CSS multi-column layout

The CSS multi-column layout module lets you divide content across multiple columns. By using the properties in this module, you can define the preferred number and width of columns, the gap size between columns, and the visual appearance of the optional column dividing lines (known as column rules). You can also define how content should flow from column to column and how to break content between columns.

Multi-column layout in action

In this example, the 1967 speech from Canada's centennial, A Lament for Confederation, by Chief Dan George, is displayed across multiple columns, similar to the way articles are displayed in printed newspapers. If you have JavaScript enabled, controls enable changing the preferred column number and width, the width of the gap between columns, whether the title and a sample blockquote should be contained in a single column or made to span all columns, and whether breaking within the paragraphs should be avoided.

To see the code for this columned layout, view the source on GitHub.

Note: Multiple-column layout is closely related to paged media. Each column box is a fragment, much like each printed page is a fragment of a document. Using the properties defined in the CSS fragmentation module, you can control how content breaks between columns and pages.

Reference

Properties

Note: Bear in mind that setting container height and line length can pose challenges for people with visual or cognitive disabilities. WCAG Success Criterion 1.4.8 states that even when the text size is doubled, content should not need to be scrolled.

Guides

Basic concepts of multi-column layout

An overview of the Multiple-column Layout specification

Styling columns

How to use column rules and manage the spacing between columns.

Spanning and balancing

How to make elements span across all columns and control the way columns are filled.

Handling overflow in multi-column layout

What happens when an item overflows the column it is in and what happens when there is too much columned content to fit a container.

Handling content breaks in multi-column layout

Introduction to the Fragmentation specification and how to control where column content breaks.

Specifications

Specification
CSS Multi-column Layout Module Level 1

See also