[If you keep the <!--comment-->, the copyright will be included here automatically]
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.
[If you keep the <!--comment-->, the status boilerplate will be included here automatically.]
This document has been a Working Draft in the CSS Working Group for several years. Multi-column layouts are traditionally used in print. On screen, multi-column layouts have been considered experimental, and implementation and use experience was deemed necessary in order to proceed. Several implementations have occurred over the past years, and this specification incorporates useful feedback from implementors as well as authors and users.
The specification was updated in April 2011 to correct a contradiction between the text and the pseudo-algorithm in section 3.4. The pseudo-algorithm was corrected and also made easier to read. The wording of a few other sections was improved in places, without changes to the functionality. In January, 2012, some examples and the description of the 'column-fill' property was revised.
This document will remain Candidate Recommendation at least until 12 May 2011. See the CR exit criteria.
[If you keep the <!--comment--> the table of contents will be included here automatically.]
(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.
On the Web, tables have also been used to describe multi-column layouts. The main benefit of using CSS-based columns is flexibility; content can flow from one column to another, and the number of columns can vary depending on the size of the viewport. Removing presentation table markup from documents allows them to more easily be presented on various output devices including speech synthesizers and small mobile devices.
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 }
However, as described below, setting both the width and number of columns rarely makes sense.
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 }
This specification introduces ten new properties, all of which are used in the examples above.
To indicate where column breaks should (or should not) appear, new keyword values are introduced.
In this example, h1 elements will always have a column
break before them, but the formatter will try to avoid column breaks
inside and after the element.
h1 {
break-before: column;
break-inside: avoid-column;
break-after: avoid-column;
}
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.
A multi-column element (or multicol element for short) is an element whose 'column-width' or 'column-count' property is not ''auto'' and therefore acts as a container for multi-column layout.
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 new type of container between the content box and the content, namely the column box (or column for short). The content of a multicol element is flowed into its column boxes.
Column boxes in a multi-column element are arranged into rows. Like table cells, the column boxes in a row are ordered in the inline direction of the multicol element. 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 row have the same column width, and all column boxes in a row have the same column height. Within each row in the multi-column element, adjacent column boxes are separated by a column gap, which may contain a column rule. All column gaps in the same row are equal. All column rules in the same row are also equal, if they appear; column rules only appear between columns that both have content.
In the simplest case a multicol element will contain only one row of columns, and the height of each column will be equivalent to the used height of the multi-column element's content box. If the multi-column element is paginated, the height of each row is constrained by the page and the content continues in a new row 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 element: the columns before the spanning element are balanced and shortened to fit their content. Content after the spanning element then flows into a new row of column boxes.
It is not possible to set properties/values on column boxes. For example, the background of a certain column box cannot be set and a column box has no concept of padding, margin or borders.
Future specifications may add additional functionality. For example, columns of different widths and different backgrounds may be supported.
Column gaps (yellow) and column rules (green) are shown in this sample rendition of a multi-column element with padding (blue). The blue and yellow is present for illustrational purposes only. In actual implementations these areas will be determined by the background.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
Pqr stu vw xyz.
To illustrate the effects of the various properties described in this specification, variations on a sample document will be used. Here is the source code of the sample document:
<html>
<style type="text/css">
div {
column-width: 15em;
column-gap: 2em; /* shown in yellow */
column-rule: 4px solid green;
padding: 5px; /* shown in blue */
}
p { margin: 0; padding: 0 }
img { display: none }
</style>
<body>
<div>
<p>Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
<img src=...>
def g hij
...
</div>
</body>
</html>
The nonsensical text in the example is the English alphabet which shows how text flows from one column to another. To simplify the visualization, the textual content of the different examples vary slightly.
Column boxes are block container boxes. That is, column boxes behave like block-level, table cell, and inline-block boxes as per CSS 2.1, section 10.1, item 2 [[!CSS21]]. However, column boxes do not establish block container boxes for elements with ''position: fixed'' or ''position: absolute''.
In this example, the width of the image is set with these rules:
img { display: block; width: 100% }
Given that the width is calculated relative to the column box, the image will be as wide as the column box:
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
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 }
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g
hij klm
nopq
rs tuv
wxy x
yz. Ab
cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
The black box represents the image.
A multi-column element establishes a new block formatting context, as per CSS 2.1 section 9.4.1.
A top margin set on the first child element of a multicol element will not collapse with the margins of the multicol element.
Nested multi-column elements are allowed, but there may be implementation-specific limits.
Finding the number and width of columns is fundamental when laying out multi-column content. When the block direction is unconstrained and no column breaks are added through style sheets, these two properties determine the outcome:
A third property, 'columns', is a shorthand property which sets both 'column-width' and 'column-count'.
| Name: | column-width |
| Value: | <length> | auto |
| Initial: | auto |
| Applies to: | non-replaced block-level elements (except table elements), table cells, and inline-block elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | the absolute length, zero or larger |
This property describes the width of columns in multicol elements.
For example, consider this style sheet:
div {
width: 100px;
column-width: 45px;
column-gap: 0;
column-rule: none;
}
There is room for two 45px wide columns inside the 100px wide element. In order to fill the available space the actual column width will be increased to 50px.
Also, consider this style sheet:
div {
width: 40px;
column-width: 45px;
column-gap: 0;
column-rule: none;
}
The available space is smaller than the specified column width and the actual column width will therefore be decreased.
To ensure that 'column-width' can be used with vertical text, column width means the length of the line boxes inside the columns.
The reason for making 'column-width' somewhat flexible is to achieve scalable designs that can fit many screen sizes. To set an exact column width, all length values (in horizontal text these are: 'width', 'column-width', 'column-gap', and 'column-rule-width') must be specified.
| Name: | column-count |
| Value: | <integer> | auto |
| Initial: | auto |
| Applies to: | non-replaced block-level elements (except table elements), table cells, and inline-block elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | specified value |
This property describes the number of columns of a multicol element.
Example:
body { column-count: 3 }
| Name: | columns |
| Value: | <'column-width'> || <'column-count'> |
| Initial: | see individual properties |
| Applies to: | non-replaced block-level elements (except table elements), table cells, and inline-block elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | see individual properties |
This is a shorthand property for setting 'column-width' and 'column-count'. Omitted values are set to their initial values.
Here are some valid declarations using the 'columns' property:
columns: 12em; /* column-width: 12em; column-count: auto */ columns: auto 12em; /* column-width: 12em; column-count: auto */ columns: 2; /* column-width: auto; column-count: 2 */ columns: 2 auto; /* column-width: auto; column-count: 2 */ columns: auto; /* column-width: auto; column-count: auto */ columns: auto auto; /* column-width: auto; column-count: auto */
The pseudo-algorithm below determines the used values for 'column-count' (N) and 'column-width' (W). There are two other variables in the pseudo-algorithm:
available-width: if the used width of the
multi-column element has not been determined when the 'column-count'
and 'column-width' must be determined (e.g., if it is floating with a
'width' of 'auto' as per CSS 2.1 section 10.3.5) this variable is
unknown, otherwise it is the same as the used width of
the multi-column element. In vertical text, the used height replaces used width in this calculation.
shrink-to-fit: this variable represents the result of
a shrink-to-fit computation. CSS does not define the exact
algorithm.
Two assumptions are being made by the pseudo-algorithm:
The floor() function rounds a number to the next smaller integer.
(01) if ((column-width = auto) and (column-count = auto)) then (02) exit; /* not a multicol element */ (03) if ((available-width = unknown) and (column-count = auto)) then (04) exit; /* no columns */ (05) if (available-width = unknown) and (column-count != auto) and (column-width != auto) then (06) N := column-count; (07) W := column-width; (08) exit; (09) if (available-width = unknown) then (10) available-width := shrink-to-fit; (11) if (column-width = auto) and (column-count != auto) then (12) N := column-count; (13) W := max(0, (available-width - ((N - 1) * column-gap)) / N); (14) exit; (15) if (column-width != auto) and (column-count = auto) then (16) N := max(1, floor((available-width + column-gap) / (column-width + column-gap))); (17) W := ((available-width + column-gap) / N) - column-gap; (18) exit; (19) if (column-width != auto) and (column-count != auto) then (20) N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap))) (21) N := max(1, N); (22) W := ((available-width + column-gap) / N) - column-gap; (23) exit
In paged media, user agents may perform this calculation on a per-page basis.
Note that, in most cases, only one of 'column-width' and 'column-count' affect the layout. If 'column-width' has a value other than ''auto'', 'column-count' indicates the maximum number of columns. However, both 'column-width' and 'column-count' are honored when the width of the element has not been determined. This can, e.g., be the case for table cells and floats.
All column boxes in a multi-column element are in the same stacking context and the drawing order of their contents is as specified in CSS 2.1. Column boxes do not establish new stacking contexts.
Column gaps and rules are placed between columns in the same multicol element. The length of the column gaps and column rules is equal to the length of the columns. Column gaps take up space. That is, column gaps will push apart content in adjacent columns (within the same multicol element).
A column rule is drawn in the middle of the column gap with the endpoints at opposing content edges of the multicol element. Column rules do not take up space. That is, the presence or thickness of a column rule will not alter the placement of anything else. If a column rule is wider than its gap, the adjacent column boxes will overlap the rule, and the rule may possibly extend outside the box of the multicol element. Column rules are painted just above the background of the multicol element. Column rules are only drawn between two columns that both have content.
| Name: | column-gap |
| Value: | <length> | normal |
| Initial: | normal |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | absolute length or 'normal' |
The 'column-gap' property sets the gap between columns. If there is a column rule between columns, it will appear in the middle of the gap.
The ''normal'' value is UA-specific. A value of ''1em'' is suggested.
Column gaps cannot be negative.
| Name: | column-rule-color |
| Value: | <color> |
| Initial: | same as for 'color' property [[!CSS21]] |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | the same as the computed value for the 'color' property [[!CSS21]] |
This property sets the color of the column rule. The <color> values are defined in [[!CSS21]].
| Name: | column-rule-style |
| Value: | <border-style> |
| Initial: | none |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | specified value |
The 'column-rule-style' property sets the style of the rule between columns of an element. The <border-style> values are defined in [[!CSS21]] and the values are interpreted as in the the collapsing border model.
The 'none' value forces the computed value of 'column-rule-width' to be '0'.
| Name: | column-rule-width |
| Value: | <border-width> |
| Initial: | medium |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | absolute length; '0' if the column rule style is 'none' or 'hidden' |
This property sets the width of the rule between columns. Negative values are not allowed.
| Name: | column-rule |
| Value: | <'column-rule-width'> || <'column-rule-style'> || [ <'column-rule-color'> | transparent ] |
| Initial: | see individual properties |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | see individual properties |
This property is a shorthand for setting 'column-rule-width', 'column-rule-style', and 'column-rule-color' at the same place in the style sheet. Omitted values are set to their initial values.
In this example, the column rule and the column gap have the same width. Therefore, they will occupy exactly the same space.
body {
column-gap: 1em;
column-rule-width: 1em;
column-rule-style: solid;
column-rule-color: black;
}
If a tall image is moved to a column on the next page to find room for it, its natural column may be left empty. If so, the column is is still considered to have content for the purpose of deciding if the column rule should be drawn.
When content is laid out in multiple columns, the user agent must determine where column breaks are placed. The problem of breaking content into columns is similar to breaking content into pages, which is described in CSS 2.1, section 13.3.3 [[!CSS21]].
Three new properties are introduced to allow column breaks to be described in the same properties as page breaks: 'break-before', 'break-after', and 'break-inside'. These properties take the same values as 'page-break-before', 'page-break-after', and 'page-break-inside' [[!CSS21]]. In addition, some new keyword values are added.
| Name: | break-before |
| Value: | auto | always | avoid | left | right | page | column | avoid-page | avoid-column |
| Initial: | auto |
| Applies to: | block-level elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | paged |
| Computed value: | specified value |
| Name: | break-after |
| Value: | auto | always | avoid | left | right | page | column | avoid-page | avoid-column |
| Initial: | auto |
| Applies to: | block-level elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | paged |
| Computed value: | specified value |
| Name: | break-inside |
| Value: | auto | avoid | avoid-page | avoid-column |
| Initial: | auto |
| Applies to: | block-level elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | paged |
| Computed value: | specified value |
These properties describe page/column break behavior before/after/inside the generated box. These values are normatively defined in [[!CSS21]]:
This specification adds the following new values:
When a page or column break splits a box, the box's margins, borders, and padding have no visual effect where the split occurs. However, the margin immediately after a forced page/column break will be preserved. A forced page/column break is a break that does not occur naturally.
In the future, new properties may describe alternate ways to handle margins, borders and padding around page/column breaks.
In this example, forced column breaks appear before h2
elements and after img elements:
.multicol { column-width: 8em }
.multicol h2 { break-before: column; margin-top: 2em }
.multicol img { break-after: column }
The top margin of h2 elements will be preserved since the column break is forced.
In this example, the formatter will try avoid column breaks inside p elements:
p { break-inside: avoid-column }
The 'column-span' property makes it possible for an element to span across several columns.
| Name: | column-span |
| Value: | none | all |
| Initial: | none |
| Applies to: | in-flow block-level elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | visual |
| Computed value: | specified value |
This property describes how many columns an element spans across. Values are:
An element that spans more than one column is called a spanning element and the box it creates is called a spanner.
In this example, an h2 element has been added to the
sample document after the sixth sentence (i.e., after the word "jkl."). This styling applies:
h2 { column-span: all; background: silver }
img { display: none }
By setting 'column-span' to ''all'', all content that appear before
the h2 element is shown before the h2
element.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
def g hij klm nopqrs
tuv wxy z. Abc de fg
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
A spanning element takes up more space than the element would take up otherwise. When space is limited, it may be impossible to find room for the spanning element. In these cases, user agents may treat the element as if 'none' had been specified on this property.
In this example, the H2 element appears later in the content, and the height of the multicol element is constrained. Therefore, the H2 element appears in the overflow and there is not room to make the element spanning. As a result, the element appears as if 'column-span: none' was specified.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
This example is similar to the previous example, except that the H2 element appears naturally in the last column. Still, there is not enough room to make the element spanning.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno.
A bc def g hij klm
nop w rstu vw xyz.
In paged media spanning elements are honored on all pages. In this example, the first three paragraphs have column breaks after them. An spanning H2 element appears after the fourth paragraph. This would appear on the first page:
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z.
Ab cde fgh i jkl mno.
Pq rstu vwxyz.
This would appear on the second page:
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
def g hij klm nopqrs
tuv wxy z. Abc de fg
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
There are two strategies for filling columns: columns can either be balanced, or not. If columns are balanced, user agents should try to fill all columns in a row so that the columns appear to have the same amount of content, while also trying to minimize the overflow content. If columns are not balanced, they are filled sequentially; some columns may end up partially filled, or with no content at all. In any case, user agents must honor forced page breaks and should try to honor 'widows', 'orphans' and other properties that may affect column lengths.
| Name: | column-fill |
| Value: | auto | balance |
| Initial: | balance |
| Applies to: | multicol elements |
| Inherited: | no |
| Percentages: | N/A |
| Media: | see below |
| Computed value: | specified value |
The values are:
In continuous media, this property does not have any effect in overflow columns (see below).
Content in the normal flow that extends into column gaps (e.g., long words or images) is clipped in the middle of the column gap.
In this example, the black image is wider than the column, and is therefore clipped.
Lorem ipsum dolor
sit amet. Nam at jus.
Sed imp er di et ris.
Cur abi tur et sapen.
Lorem ipsum dolor
sit amet. Nam at jus.
Sed imp er di et ris.
Cur abi tur et sapen.
Vivamus a metus.
Aenean at risus
pharetra ante
luctu
feugiat quis enim.
Cum sociis natoque
penatibus et magni.
Lorem ipsum dolor
sit amet. Nam at jus.
Sed imp er di et ris.
Cur abi tur et sapen.
Vivamus a metus.
Aenean at risus
pharetra ante
luctu
feugiat quis enim.
Cum sociis natoque
penatibus et magni.
Content and column rules that extend outside column boxes at the edges of the multi-column element are clipped according to the 'overflow' property.
A multicol element can have more columns than it has room for due to:
Columns that appear outside the multicol element in continuous media are called overflow columns.
In this example, the height of the multi-column element has been constrained to a maximum height. Also, the style sheet specifies that overflowing content should be visible:
div {
max-height: 5em;
overflow: visible;
}
As a result, the number of columns is increased.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
In paged media, the overflow content goes into column on subsequent pages. Given the same content as in the previous example and a page box that only has room for five lines of formatted text, this would appear on the first page:
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
M nop qrst uv wx yz.
Ab cde fgh i jkl. Mno
Assuming column balancing, this would appear on the second page:
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z. Abc de fg
hi jklmno. Pqrstu vw
x yz. Abc def ghi jkl.
In this example, explicit column breaks are generated after paragraphs:
p {
break-after: column;
}
As a result, the number of columns increases and the extra columns are added in the inline direction:
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxyz. Abc defghi
jklmno pqrstu vwxyz.
Ab cde fgh i jkl mno.
Pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z.
In paged media, extra columns are shown on the next page. Given the same code as the previous example, the last paragraph appears on the second page. This would appear on the first page:
Ab cde fgh i jkl. Mno
pqr stu vw xyz.
Ab cde fgh i jkl. Mno
pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxyz. Abc defghi
jklmno pqrstu vwxyz.
Ab cde fgh i jkl mno.
This would appear on the second page:
Pqr stu vw xyz. A bc
def g hij klm nopqrs
tuv wxy z.
Conforming UAs must flow the content of an element into several columns according to this specification.
The 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]]
As described in the W3C process document, a Candidate Recommendation (CR) is a specification that W3C recommends for use on the Web. The next stage is Recommendation, when the specification is sufficiently implemented.
For this specification to be proposed as a W3C Recommendation, the following conditions shall be met. There must be at least two independent, interoperable implementations of each feature. Each feature may be implemented by a different set of products, there is no requirement that all features be implemented by a single product. For the purposes of this criterion, we define the following terms:
A minimum of sixth months of the CR period must have elapsed. This is to ensure that enough time is given for any remaining major errors to be caught.
Features will be dropped if two or more interoperable implementations are not found by the end of the CR period.
Features may/will also be dropped if adequate/sufficient (by judgment of CSS WG) tests have not been produced for those feature(s) by the end of the CR period.
This document is based on several older proposals and comments on older proposals. Contributors include Øyvind Stenhaug, Sylvain Galineau, Giovanni Campagna, David Hyatt, David Singer, David Woolley, Elika Etemad, Björn Höhrmann, Joost de Valk, Peter-Paul Koch, Shelby Moore, Till Halbach, Cédric Savarese, Andy Clarke, Robert O'Callahan, Markus Mielke, Alex Mogilevsky, Sergey Genkin, Michael Day, Melinda Grant, Kevin Lawver, Anton Prowse, L. David Baron, Bert Bos, Dave Raggett, Chris Wilson, Robert Stevahn, Peter Linss, Chris Lilley, Steve Zilles, Tantek Çelik, Daniel Glazman and Ian Hickson.
[Here will be inserted the file "normative.inc"]
[Here will be inserted the file "informative.inc"]