CSS Multi-column Layout Module Level 2

Editor’s Draft,

More details about this document
This version:
https://drafts.csswg.org/css-multicol-2/
Issue Tracking:
CSSWG Issues Repository
Inline In Spec
Editors:
Florian Rivoal (On behalf of Bloomberg)
(Google)
Suggest an Edit for this Spec:
GitHub Editor

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.

This is a delta specification over CSS Multi-column Level 1. Once the level 1 specification is final, its content will be integrated into this specification, which will then replace it. Until then, CSS Multi-column Level 2 only contains additions and extensions to level 1

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 www-style@w3.org.

This document is governed by the 03 November 2023 W3C Process Document.

1. Introduction

Add final content from previous level

2. Module Interactions

This document defines new features not present in earlier specifications. In addition, once final, it will replace and supersede the following:

3. The multi-column model

Add final content from previous level

4. The number and width of columns

Add final content from previous level

4.1. column-width

Add final content from previous level

4.2. column-count

Add final content from previous level

4.3. columns

Add final content from previous level

4.4. Pseudo-algorithm

Add final content from previous level

4.5. Stacking context

Add final content from previous level

4.6. Styling Columns: the ::column pseudo-element

The ::column pseudo-element represents the individual columns in a multi-column container. It only exists on multi-column containers.

A multi-column container has as many ::column pseudo-elements as it has columns. They cannot be individually addressed; any styles applied to a multicol’s ::column pseudo-elements apply to all of them on that element. Each ::column has the same size and position as its corresponding column: the same size as the column’s available space in the inline axis and the container’s content box in the block axis. (It does not cover the gaps/rules between columns.)

::column pseudo-elements are treated as children of their multi-column container, without any contents. They do not wrap the contents of the column, just fill the same space.

The ::column pseudo-element accepts only a very limited set of properties:

Additionally, a ::column pseudo-element can have a ::scroll-marker pseudo-element of its own, as ::column::scroll-marker. (Other pseudo-elements do not exist on ::column.) Such ::scroll-marker pseudo-elements inherit from the ::column pseudo-element’s superior parent, rather than the ::column itself.

Note: This list of properties and pseudo-elements that work on ::column will likely be expanded in the future, as we develop more features that could usefully care about the position of a column without caring about the contents.

5. Column gaps and rules

Add final content from previous level

5.1. column-gap

Add final content from previous level

5.2. column-rule-color

Add final content from previous level

5.3. column-rule-style

Add final content from previous level

5.4. column-rule-width

Add final content from previous level

5.5. column-rule

Add final content from previous level

6. Column breaks

The previous level of this specification defined how the user agent must determine where column breaks are placed when content is laid out in multiple columns. The [CSS3-BREAK] module has since been introduced to define how to break the content across pages, columns, or CSS Regions, and supersedes the column break section of [CSS3-MULTICOL].

This specification defers to [CSS3-BREAK] on this topic.

6.1. break-before, break-after, break-inside

The break-before, break-after and break-inside properties are now defined in [CSS3-BREAK].

7. Spanning columns

The column-span property makes it possible for an element to span across several columns. This specification adds <integer> to the values available in the previous level.

7.1. column-span

Name: column-span
Value: none | <integer [1,∞]> | all | auto
Initial: none
Applies to: in-flow block-level elements
Inherited: no
Percentages: N/A
Computed value: specified value
Canonical order: per grammar
Animation type: discrete

This property describes how many columns an element spans across. Values are:

none
all

Add final content from previous level

<integer [1,∞]>
The element spans the specified number of columns. Values must be greater than 0. If the specified integer value is equal to, or larger than the number of columns in the multicol element, the number of columns spanned will be the same as if column-span: all had been specified.
This definition is insufficient.
  • Does column-span: 1 count as column-span: none, or does it create a spanner (which is a BFC)?
  • Which columns does it span?
  • How does that affect height calculations, and interact with column-fill
auto
The number of columns spanned by the element depends on its min-content outer size in the inline direction of the multi-column container. If it is smaller than the used value of column-width, this is the same as if column-span: none had been specified. Otherwise, the number of columns spanned is the smallest positive integer n for which n × column-width + (n - 1) × column-gap is larger than the min-content outer size. If this would be larger than the number of columns, the number of columns spanned will be the same as if column-span: all had been specified.

If column-span: 1 does not do the same as column-span: none, should this behave as column-span: 1 or as column-span: none when the element is small enough?

Add final content from previous level possibly with adjustments to account for <integer> values

8. Filling columns

Add final content from previous level

8.1. column-fill

Add final content from previous level

9. Overflow

9.1. Overflow inside multicol elements

Add final content from previous level

9.2. Pagination and overflow outside multicol elements

Add final content from previous level

Acknowledgments

This document builds upon Håkon Wium Lie’s work in [CSS3-MULTICOL], and is based on several older proposals and comments on older proposals. Contributors include:

Add final level 1 contributor list

Privacy and Security Considerations

Delta spec lol

Conformance

Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with <strong class="advisement">, like this: UAs MUST provide an accessible alternative.

Tests

Tests relating to the content of this specification may be documented in “Tests” blocks like this one. Any such block is non-normative.


Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
A CSS style sheet.
renderer
A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

Partial implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported component values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

Non-experimental implementations

Once a specification reaches the Candidate Recommendation stage, non-experimental implementations are possible, and implementors should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

Index

Terms defined by this specification

Terms defined by reference

References

Normative References

[CSS-ALIGN-3]
Elika Etemad; Tab Atkins Jr.. CSS Box Alignment Module Level 3. URL: https://drafts.csswg.org/css-align/
[CSS-BOX-4]
Elika Etemad. CSS Box Model Module Level 4. URL: https://drafts.csswg.org/css-box-4/
[CSS-OVERFLOW-3]
Elika Etemad; Florian Rivoal. CSS Overflow Module Level 3. URL: https://drafts.csswg.org/css-overflow-3/
[CSS-OVERFLOW-5]
CSS Overflow Module Level 5. Editor's Draft. URL: https://drafts.csswg.org/css-overflow-5/
[CSS-REGIONS-1]
Rossen Atanassov; Alan Stearns. CSS Regions Module Level 1. URL: https://drafts.csswg.org/css-regions/
[CSS-SCROLL-SNAP-1]
Matt Rakow; et al. CSS Scroll Snap Module Level 1. URL: https://drafts.csswg.org/css-scroll-snap-1/
[CSS-SIZING-3]
Tab Atkins Jr.; Elika Etemad. CSS Box Sizing Module Level 3. URL: https://drafts.csswg.org/css-sizing-3/
[CSS-VALUES-4]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4. URL: https://drafts.csswg.org/css-values-4/
[CSS-WRITING-MODES-4]
Elika Etemad; Koji Ishii. CSS Writing Modes Level 4. URL: https://drafts.csswg.org/css-writing-modes-4/
[CSS3-BREAK]
Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 3. URL: https://drafts.csswg.org/css-break/
[CSS3-MULTICOL]
Florian Rivoal; Rachel Andrew. CSS Multi-column Layout Module Level 1. URL: https://drafts.csswg.org/css-multicol/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119

Property Index

Name Value Initial Applies to Inh. %ages Anim­ation type Canonical order Com­puted value
column-span none | <integer [1,∞]> | all | auto none in-flow block-level elements no N/A discrete per grammar specified value

Issues Index

Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
This definition is insufficient.
If column-span: 1 does not do the same as column-span: none, should this behave as column-span: 1 or as column-span: none when the element is small enough?
Add final content from previous level possibly with adjustments to account for <integer> values
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final content from previous level
Add final level 1 contributor list
MDN

break-after

In all current engines.

Firefox65+Safari10+Chrome50+
Opera37+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile37+

break-before

In all current engines.

Firefox65+Safari10+Chrome50+
Opera37+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile37+

break-inside

In all current engines.

Firefox65+Safari10+Chrome50+
Opera37+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile37+
MDN

column-count

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-fill

In all current engines.

Firefox52+Safari9+Chrome50+
Opera?Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile?
MDN

column-gap

In all current engines.

Firefox1.5+Safari3+Chrome1+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile11.1+
MDN

column-rule-color

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-rule-style

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-rule-width

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-rule

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-span

In all current engines.

Firefox71+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

column-width

In all current engines.

Firefox50+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android50+iOS Safari9+Chrome for Android?Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

columns

In all current engines.

Firefox52+Safari9+Chrome50+
Opera11.1+Edge79+
Edge (Legacy)12+IE10+
Firefox for Android52+iOS Safari9+Chrome for Android50+Android WebView50+Samsung Internet?Opera Mobile11.1+
MDN

widows

FirefoxNoneSafari1.3+Chrome25+
Opera9.2+Edge79+
Edge (Legacy)12+IE8+
Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile?