CSS Multi-column Layout Module Level 1

Editor’s Draft,

More details about this document
This version:
https://drafts.csswg.org/css-multicol/
Latest published version:
https://www.w3.org/TR/css-multicol-1/
Previous Versions:
Implementation Report:
https://test.csswg.org/harness/results/css-multicol-1_dev/grouped/
Feedback:
CSSWG Issues Repository
Disposition of Comments
Editors:
Florian Rivoal (On behalf of Bloomberg)
(Google)
Former Editor:
(Opera Software)
Suggest an Edit for this Spec:
GitHub Editor
Test Suite:
https://wpt.fyi/results/css/css-multicol/

Abstract

This specification describes multi-column layouts in CSS, a style sheet language for the web. Using functionality described in the specification, content can be flowed into multiple columns with a gap and a rule between them.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc.

Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

Please send feedback by filing issues in GitHub (preferred), including the spec code “css-multicol” in the title, like this: “[css-multicol] …summary of comment…”. All issues and comments are archived. Alternately, feedback can be sent to the (archived) public mailing list [email protected].

This document is governed by the 18 August 2025 W3C Process Document.

1. Introduction

(This section is not normative.)

This module describes multi-column layout in CSS. By using functionality described in this document, style sheets can declare that the content of an element is to be laid out in multiple columns.

Other layout methods in CSS, when applied to a parent element, change the display properties of the direct children. For example if a three column grid layout is created, the direct children of the grid container become grid items and are placed into the column tracks, one element per cell with additional rows created as needed.

The child elements of a multi-column container however continue in normal flow, that flow is arranged into a number of columns. These columns have a flexible inline size, and therefore respond to available space by changing the size or number of columns displayed.

Multi-column layouts are easy to describe in CSS. Here is a simple example:

body { column-width: 12em }

In this example, the body element is set to have columns at least 12em wide. The exact number of columns will depend on the available space.

The number of columns can also be set explicitly in the style sheet:

body { column-count: 2 }

In this case, the number of columns is fixed and the column widths will vary depending on the available width.

The shorthand columns property can be used to set either, or both, properties in one declaration.

In these examples, the number of columns, the width of columns, and both the number and width are set, respectively:
body { columns: 2 }
body { columns: 12em }
body { columns: 2 12em }

Another group of properties introduced in this module describe gaps and rules between columns.

body {
  column-gap: 1em;
  column-rule: thin solid black;
}

The first declaration in the example above sets the gap between two adjacent columns to be 1em. Column gaps are similar to padding areas. In the middle of the gap there will be a rule which is described by the column-rule property.

The values of the column-rule property are similar to those of the CSS border properties. Like border, column-rule is a shorthand property.

In this example, the shorthand column-rule declaration from the above example has been expanded:
body {
  column-gap: 1em;
  column-rule-width: thin;
  column-rule-style: solid;
  column-rule-color: black;
}

The column-fill and column-span properties give style sheets a wider range of visual expressions in multi-column layouts.

In this example, columns are set to be balanced, i.e., to have approximately the same length. Also, h2 elements are set to span across all columns.
div { column-fill: balance }
h2 { column-span: all }
Tests

This specification introduces ten new properties, all of which are used in the examples above.

If all column properties have their initial value, the layout of an element will be identical to a multi-column layout with only one column.

Column gaps (diagonal hatching) and column rules are shown in this sample rendition of a multi-column container with padding (cross hatching). The hatched areas are present for illustrational purposes only. In actual implementations these areas will be determined by the background, the second image shows a rendering of a multi-column container with column-rules.
a diagram showing the various parts of multi-column layout key to the conventions used to display invisible parts of diagram
A multi-column layout with the non-visible column-span and padding inside the multicol container highlighted.
a diagram showing the various parts of multi-column layout
The same layout as in the first image, as it would be displayed by an implementation.

1.1. Value Definitions

This specification follows the CSS property definition conventions from [CSS21] using the value definition syntax from [CSS-VALUES-3]. Value types not defined in this specification are defined in CSS Values & Units [CSS-VALUES-3]. Combination with other CSS modules may expand the definitions of these value types.

In addition to the property-specific values listed in their definitions, all properties defined in this specification also accept the CSS-wide keywords as their property value. For readability they have not been repeated explicitly.

2. The Multi-Column Model

An element whose column-width or column-count property is not auto establishes a multi-column container (or multicol container for short), and therefore acts as a container for multi-column layout.

Tests

Basic multicol tests.


Tests demonstrating that auto values do not create a multicol container.


Multicol properties do not inherit.


Multicol with scrolled columns.


Multicol with zero height.


In the traditional CSS box model, the content of an element is flowed into the content box of the corresponding element. Multi-column layout introduces a fragmentation context formed of anonymous fragmentation containers called column boxes (or columns for short). These column boxes establish an independent block formatting context into which the multi-column container’s content flows, and form the containing block for its non-positioned children.

In this example, the width of the image is set with these rules:
img {
  display: block;
  width: 100%;
}

Given that the column box creates a new block formatting context, the width is calculated relative to the column box. Therefore the image will not overflow the column box:

an image contained inside a column box
The image is constrained by the column box that it is displayed in.
Given that the column box creates a new block formatting context, a top margin set on the first child element of a multicol container will not collapse with the margins of the multicol container.
The first paragraph has a 'margin-top' of ''1em'', which appears before the text.
The margin above the first paragraph has not collapsed, leaving a 1em margin above the first line in the multicol container.
Tests

Floats that appear inside multi-column layouts are positioned with regard to the column box where the float appears.

In this example, this CSS fragment describes the presentation of the image:
img {
  display: block;
  float: right;
}

In the HTML, the image appears after the sentence ending, "the leg of a chicken".

an image floated and contained inside a column box
The image is floated inside the column box it appears in.

Content overflowing a column box in the block axis fragments and continues in the next column box.

Note: Column boxes, which are anonymous boxes, do not become the containing block for absolutely positioned boxes. The position property, which establishes a containing block for such boxes, applies to the multicol container, it being the principal box.

Tests
In this example, the multi-column container has position: relative thus becoming the containing block. The image is a direct child of the multi-column container and has position: absolute. It takes positioning from the multi-column container and not from the column box.
.container {
  position: relative;
  column-count: 3;
}
img {
  position: absolute;
  top: 20px;
  left: 40px;
}
The absolutely positioned image is positioned by reference to the [=multi-column container=] not the [=column box=].
The figure demonstrates that the absolutely positioned image is positioned by reference to the multicol container and not the column box.

Out-of-flow descendants of a multi-column container do affect column balancing, and the block-size of the multi-column container.

Tests

The column boxes are ordered in the inline base direction of the multicol container and arranged into multicol lines. The column width is the length of the column box in the inline direction. The column height is the length of the column box in the block direction. All column boxes in a line have the same column width, and all column boxes in a line have the same column height.

Tests

The following tests relate to baseline alignment of the content of columns, though this is not defined in this specification.


The following tests check the behavior of list items that are also muticol containers.


Testing grid items inside multicol


The following tests check the behavior of table elements.


The following tests check that paint order is correct.


The following tests relate to animation or transformation of multicol properties.


Tests related to implementation bugs, not linked to specific normative text.


Tests related to printing and paged media as related to multicol.


Note: In text set using a vertical writing mode, the block direction runs horizontally. In a vertical writing mode columns are laid out horizontally, and the direction of the flow of blocks may be right to left, or left to right. The column-width property therefore refers to the inline size of the column, and not the physical horizontal width.

The first image shows horizontal text with a LTR inline direction. The second shows vertical text with blocks flowing right to left. The third shows vertical text with blocks flowing left to right.
A diagram showing the different ways columns may be arranged due to writing mode.
From left to right: horizontal-tb, vertical-rl, vertical-lr.
Tests

Tests regarding vertical writing modes.


Within each multicol line in the multi-column container, adjacent column boxes are separated by a column gap, which may contain a column rule. All column gaps in the same multi-column container are equal. All column rules in the same multi-column container are also equal, if they appear; column rules only appear between columns that both have content.

In the simplest case a multicol container will contain only one line of columns, and the height of each column will be equivalent to the used height of the multi-column container’s content box. However, fragmentation or spanners can split the content of the multi-column container into multiple multicol lines.

If the multi-column container is paginated, the height of each column is constrained by the page and the content continues in a new line of column boxes on the next page; a column box never splits across pages.

The same effect occurs when a spanning element divides the multi-column container: the columns before the spanning element are balanced and shortened to fit their content. Content after the spanning element then flows into a new, subsequent line of column boxes.

a diagram showing a spanning element causing the shortened columns above the element with text continuing in new columns below
A demonstration of how the spanning element divides the multicol container.

A multi-column container therefore is a regular block container that establishes a new independent formatting context whose contents consist of a series of multicol lines and multicol spanners. Each multi-column line acts as a block-level box that establishes a multi-column formatting context for its column boxes; and each spanner acts as a block-level box that establishes an independent formatting context with its type depending on its display value as usual.

Nested multi-column containers are allowed, but there may be implementation-specific limits.

Tests