Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
<pre class='metadata'>
Title: CSS Regions Module Level 1
Status: ED
Work Status: Exploring
Shortname: css-regions
Level: 1
Group: csswg
Previous Version:
Previous Version:
Editor: Rossen Atanassov, Microsoft Corporation,, w3cid 49885
Editor: Alan Stearns, Adobe Systems&#44; Inc.,, w3cid 46659
Former Editor: Vincent Hardy, Adobe Systems&#44; Inc.,
!Issues list: <a href=";product=CSS&amp;component=Regions&amp;resolution=---&amp;cmdtype=doit">In Bugzilla</a>
Abstract: The CSS Regions module allows content from one or more elements to flow through one or more boxes called CSS Regions, fragmented as defined in [[!CSS3-BREAK]]. This module also defines CSSOM to expose both the inputs and outputs of this fragmentation.
Link Defaults: css2 (property) max-height, dom-core-ls (interface) range
Ignored Terms: document, element, eventtarget
<h2 id="introduction">
<em>This section is non-normative.</em>
The core concept behind CSS Regions
is the ability to say,
"Display <em>this</em> content (a <a>named flow</a>)
over <em>there</em> (a <a>region chain</a>)."
The simplest example is:
<div class="example">
#this {
flow-into: my-flow;
#there {
flow-from: my-flow;
These two declarations will take
the element that matches <code>#this</code>,
put it into a flow named "my-flow",
and display the contents of "my-flow"
in the box from the element that matches <code>#there</code>.
This example has a single content source for the <a>named flow</a>,
and a single box for the <a>region chain</a>.
<a>Named flows</a> can also have multiple sources
and use multiple boxes for the <a>region chain</a>.
The <a>named flow</a> mechanism can be used
in several different ways -
some of which are
custom overflow handling,
aggregating content,
linked display boxes,
magazine-style layout,
and flowing content through areas in a paginated view.
<div class="example">
Linked display boxes can be created
to display article content above and below
other content on a page.
Given markup like this:
<pre><code class="html">
&lt;article&gt; ...some content... &lt;/article&gt;
&lt;aside&gt; ad or image content &lt;/aside&gt;
The &lt;aside&gt; content will be displayed
below all of the article content.
On a large screen the page might display without scrolling,
but on a small screen the &lt;aside&gt; content
might not be visible until the view scrolls.
If it's important to show at least some
of the &lt;aside&gt; content in the initial view,
CSS Regions can fragment the article content across two boxes -
one above the &lt;aside&gt; and one below.
In this example (for simplicity's sake)
we create the boxes with additional elements:
<pre><code class="html">
&lt;article&gt; ...some content... &lt;/article&gt;
&lt;div class="top region"&gt;&lt;/div&gt;
&lt;aside&gt; ad or image content &lt;/aside&gt;
&lt;div class="region"&gt;&lt;/div&gt;
article {
flow-into: article-flow;
.region {
flow-from: article-flow;
.top {
max-height: 80vh;
So the top box in the <a>region chain</a>
is limited to 80% of the viewport height.
If the article content doesn't fit in that box,
the article will continue
in the second box after the &lt;aside&gt; content.
<figure style="float:left; margin:1em;">
<img alt="Article and aside rendering without CSS Regions"
Rendering without CSS Regions
<figure style="float:left; margin:1em;">
<img alt="Article and aside rendering with CSS Regions"
Rendering with CSS Regions
<p style="clear:left;">In the images above,
the gray area represents
the content below the screen edge
in the initial view.
This example links just two boxes together,
but more boxes could be added to the <a>region chain</a>
to regularly interleave other content with the article.
<div class="example">
Custom overflow handling can be accomplished by linking a separate overflow box. In this example, the overflow box is nestled inside a menu in the markup, and only displays if the menu is toggled.
<pre><code class="html">
&lt;nav&gt; ...some links... &lt;/nav&gt;
&lt;div class="menu"&gt;
...some more links...
If the links in the main nav element are placed in a <a>named flow</a>, that flow can be directed through both the main nav element and the overflow nav box in the menu:
nav a {
flow-into: nav-link-flow;
nav {
flow-from: nav-link-flow;
Then the main nav element and the menu can be arranged with constraints such that when the screen is too narrow for the main nav element to display all of the navigation links, the overflow moves to the menu.
<img alt="Wide nav bar showing all of the links"
Wide rendering with menu shown
<img alt="Narrow nav bar with some of the links in the menu"
Narrow rendering with menu shown
<div class="example">
Since content is assigned to a <a>named flow</a> using a CSS selector, the content can come from multiple sources. The resulting aggregation can be displayed in a single box or flowed through multiple boxes as above.
So given this markup:
<pre><code class="html">
&lt;div class="breaking-news"&gt;&lt;/div&gt;
&lt;article&gt;News story&lt;/article&gt;
&lt;article class="breaking"&gt;Sports story&lt;/article&gt;
&lt;article&gt;News story&lt;/article&gt;
&lt;article class="breaking"&gt;Entertainment story&lt;/article&gt;
&lt;article&gt;Sports story&lt;/article&gt;
You can take the "breaking" stories and display them above all the others using two lines of CSS:
.breaking {
flow-into: breaking-news;
.breaking-news {
flow-from: breaking-news;
Given more data accessible to CSS selectors, you could rearrange the articles in other ways (sports on top, etc.) depending on the user's preferences.
<div class="note"><span class="note-prefix">Note </span>
<strong><a>CSS Regions</a> are independent from layout</strong>
Any of the CSS layout facilities can be used
to create, position and size boxes that can become <a>CSS Regions</a>.
The CSS Regions module does not
define a layout mechanism
and is meant to integrate
with existing and future CSS layout facilities.
<div class="note"><span class="note-prefix">Note </span>
<strong><a>CSS Regions</a> do not have to be elements</strong>
The CSS Regions module is independent
of the layout of boxes and
the mechanisms used to create them.
For simplicity,
our examples tend to
use elements to define the boxes.
Any other mechanism available
in markup or style
to create stylable boxes could be used instead,
such as pseudo-elements
or the @slot rule proposed
by the CSS Page Template Module [[CSS3-PAGE-TEMPLATE]].
The only requirement
for box to become a <a>CSS Region</a>
is that the 'flow-from' property applies to the box.
<h3 id="values">
Value Definitions</h3>
This specification follows the <a href="">CSS property definition conventions</a> from [[!CSS2]]
using the <a href="">value definition syntax</a> from [[!CSS-VALUES-3]].
Value types not defined in this specification are defined in CSS Values &amp; 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 <a>CSS-wide keywords</a> as their property value.
For readability they have not been repeated explicitly.
<h2 id="css-regions-concepts">
CSS Regions concepts</h2>
<h3 id="regions">
A <dfn export>CSS Region</dfn>
is a block container
that has an associated
<em><a>named flow</a></em>
(see the 'flow-from' property).
<h3 id="region-chain-section">
Region chain</h3>
A <dfn export>region chain</dfn>
is the sequence of regions
that are associated with
a <a>named flow</a>.
<a>CSS Regions</a> in a
<a>region chain</a> receive content from the
<a>named flow</a> following their order in the chain.
<a>CSS Regions</a> are organized
into a <a>region chain</a>
according to the document order.
<h3 id=last-region>
Last region</h3>
A <a>CSS region</a> is deemed to be the <dfn lt="last usable region | last usable CSS region">last usable region</dfn>
in a <a>region chain</a>
if it is the first region in that chain to have <a>layout containment</a>,
or the last region in the chain if none of them have <a>layout containment</a>
(See [[!CSS-CONTAIN-1]]).
<h3 id="named-flow-section">
Named flows</h3>
A <dfn>named flow</dfn> is the ordered sequence of content
associated with a flow with a given identifier.
Contents in a <a>named flow</a> are ordered
according to the document order.
Content is placed into a <a>named flow</a>
with the 'flow-into' property.
The content in a <a>named flow</a> is laid out
in the <a>region chain</a>
that is associated with this <a>named flow</a>
using the 'flow-from' property.
Content from a <a>named flow</a>
is broken up between regions
according to the regions flow breaking rules.
A <a>named flow</a> is created when
some content is moved
into the flow with the given identifier
or when at least one <a>CSS Region</a>
requests content from that flow.
<h3 id="regions-flow-breaking-rules">
Regions flow breaking rules</h3>
Breaking a <a>named flow</a> across a <a>region chain</a>
is similar to breaking a document's content across pages
(see [[CSS3PAGE]])
or a multi-column container's content across column boxes
(see [[CSS3COL]]).
One difference is that page boxes are generated
based on the available content
whereas a <a>region chain</a> is a set of recipient boxes
for the <a>named flow</a> content
whose dynamic generation is not in the scope
of this specification.
Each <a>CSS Region</a> in turn
consumes content from its associated <a>named flow</a>.
The <a>named flow</a> content is positioned
in the current region
until a natural or forced region break occurs,
at which point the next region
in the <a>region chain</a>
becomes the current region.
If there are no more usable <a>CSS Regions</a>
in the <a>region chain</a>
and there is still content in the flow,
the positioning of the remaining content
is controlled by the 'region-fragment' property
on the <a>last usable CSS Region</a> in the chain.
The CSS regions module follows
the fragmentation rules defined
in the CSS Fragmentation Module Level 3
(see [[!CSS3-BREAK]]).
<h2 id="properties">
<h3 id="the-flow-into-property">
The 'flow-into' property</h3>
<div class="issue-marker wrapper">
<div class="issue-marker">
<a href="">Issue-16527</a>
<div class="issue-details">
<p class="short-desc">[Shadow]: getFlowByName and shadow DOM</p>
The ‘flow-into’ property can place an element
or its contents
into a <a>named flow</a>.
Content that belongs to the same flow
is laid out in the <a>region chain</a>
associated with that flow.
<pre class='propdef'>
Name: flow-into
Value: none | <<ident>> [element|content]?
Initial: none
Applies To: All elements, but not <a href="">pseudo-elements</a> such as <code>::first-line</code>, <code>::first-letter</code>, <code>::before</code> or <code>::after</code>.
Inherited: no
Computed Value: as specified
Animation type: not animatable
The element is not moved
to a <a>named flow</a>
and normal CSS processing takes place.
<dt><a href="">&lt;ident&gt;</a></dt>
If the keyword <dfn>element</dfn> is present
or neither keyword is present,
then the element is taken out
of its parent's flow
and placed into the flow
with the name '<a href="">&lt;ident&gt;</a>'.
If the keyword <dfn>content</dfn> is present,
then only the element's contents
are placed into the named flow.
The element or content is said to have
a <dfn id="specified-flow">specified flow</dfn>.
The values <code class=css>none</code>, <code class=css>inherit</code>, <code class=css>default</code>, <code class=css>auto</code> and <code class=css>initial</code>
are invalid flow names.
The 'flow-into' property affects
the visual formatting of elements or contents
placed into a <a>named flow</a>
and of the <a>region chain</a> laying out content
from a <a>named flow</a>.
The 'flow-into' property does not affect
the CSS cascade and inheritance
for the elements on which it is specified.
The 'flow-into' property does not affect the
<a href="">DOM</a>
[[!DOM]] position of an element or its contents.
The 'flow-into' property does not affect ordering
in non-visual media
(such as <a href="">speech</a>).
Likewise, 'flow-into' does not affect
the default traversal order
of sequential navigation modes
(such as cycling through links,
see e.g. <a href=""><code>tabindex</code></a> [[HTML]]).
A <a>named flow</a> needs to be associated
with a <a>region chain</a>
(one or more <a>CSS Regions</a>)
for its content to be visually formatted.
If no <a>region chain</a> is associated
with a given <a>named flow</a>,
the content in the <a>named flow</a>
is not rendered:
it does not generate boxes
and is not displayed.
The children of an element or content
with a specified flow
may themselves have a specified flow,
in which case they become
the next sibling of the latest element
or content collected in that flow.
In some cases,
the child can become the next sibling
for one of its ancestors in the same flow.
Content in a <a>named flow</a>
is sequenced in document order.
The visual formatting model
uses the relationships between content
in the named flow as input,
rather than the contents&rsquo; position
in the DOM.
Each <a>CSS Region</a> in a <a>region chain</a>
establishes a containing block for absolutely positioned
elements in the <a>named flow</a> (see [[!CSS21]]).
That first <a>CSS Region</a> in a <a>region chain</a>
establishes the initial containing block for such absolutely
positioned elements.
<span>Regions</span> don't establish a containing block for
fixed positioned elements in the <a>named flow</a>.
Such fixed positioned elements are still positioned relative
to the viewport or the page area even if they have been
redirected into a named flow
The first region defines the principal
<a href="">writing mode</a>
for the entire flow.
The writing mode
on subsequent regions is ignored.
If an element has <a>style containment</a> (See [[!CSS-CONTAIN-1]]),
then the 'flow-into' property must be <a for=property>scoped</a> to that element.
<div class="note"><span class="note-prefix">Note </span>
The 'flow-into' property moves an element into the flow
and the interplay with selectors should be considered carefully.
For example,
<pre>table {flow-into: table-content}</pre>
will move all tables in the "table-content"
<a>named flow</a>.
However, the
<pre>table &gt; * {flow-into: table-content} ...</pre>
selector will move all immediate children
of all table elements
into the "table-content" <a>named flow</a>
(which may be useful as it will usually result,
if the immediate children are rows,
in merging rows of multiple tables),
but the
<pre>table * {flow-into: table-content}</pre>
selector will move all descendants
of table elements into the "table-content" <a>named flow</a>,
transforming the element tree
into a flat list in order of opening tags
(which is probably not intentional).
This will make all the descendants
of table elements siblings
in the <a>named flow</a>.
Having the descendants become siblings
in the <a>named flow</a>
results in a different processing
(see <a href="">CSS 2.1's anonymous table objects</a>).
This note illustrates how authors must exercise caution
when choosing a particular selector
for setting the 'flow-into' property
to avoid unintended results.
<div class="note"><span class="note-prefix">Note </span>
Another consequence of moving elements
into <a>named flows</a> is that surrounding whitespace
is not moved into the named flow.
If you have code like this:
span {flow-into: span-content}
Then the "span-content" named flow contents
will contain this:
Which will change the display
from "one two" to "onetwo".
If whitespace is significant,
then moving the parent
that contains the whitespace
to the named flow
is required.
<h3 id="flow-from">
The 'flow-from' property</h3>
The 'flow-from' property makes
a block container a region
and associates it with
a <a>named flow</a>.
<pre class='propdef'>
Name: flow-from
Value: <<ident>> | none
Initial: none
Applies To: Non-replaced <a href="">block containers</a>. <br/> This might be expanded in future versions of the specification to allow other types of containers to receive flow content.
Inherited: no
Computed Value: as specified
Animation type: not animatable
The block container is not a <a>CSS Region</a>.
<dt><strong><a href="">&lt;ident&gt;</a></strong></dt>
The block container becomes a <a>CSS Region</a>
(except as detailed in the text below),
and is ordered in a <a>region chain</a>
according to its document order.
The content from the flow
with the <a href="">&lt;ident&gt;</a>
name will be <a href="#region-flow-break">broken
into fragments</a> and visually formatted in the
<a href="">principal boxes</a>
of the <span>regions</span>
in the <a>region chain</a>.
If there is no flow with name
<a href="">&lt;ident&gt;</a>,
then the block container does not
format any content visually.
If the 'content' property computes
to something else than ''content/normal''
(or ''content/none'' for a pseudo-element),
the block container does not become
a <a>CSS Region</a>.
If the 'display' property
of the block container
or one of its ancestors
computes to ''display/none'',
the block container does not become
a <a>CSS Region</a>.
A <a>CSS Region</a>&rsquo;s document children
are not visually formatted
unless they are directed
to a <a>named flow</a>
with an associated <a>region chain</a>.
Block container pseudo-elements where
the value of 'flow-from' computes to an
<a href="">&lt;ident&gt;</a>
and the value of 'content' computes to ''content/none''
are generated as <a>CSS Regions</a>,
which is an update to the behavior
described in [[!CSS21]].
If an element has <a>style containment</a> (See [[!CSS-CONTAIN-1]]),
then the 'flow-from' property must be <a for=property>scoped</a> to that element.
<div class="note"><span class="note-prefix">Note </span>
A block container becomes a <a>CSS Region</a>
when its 'flow-from' property is set
to a valid <a href="">&lt;ident&gt;</a> value,
even if there is no content contributing
to the referenced flow.
For example:
flow-into: thread;
flow-from: thread;
&lt;div class=region&gt;div content&lt;/div&gt;
There is no element matching
the <code>.article</code> selector
and therefore no content
in the <code>thread</code> flow.
However, the block container matching
the <code>.region</code> selector
is still associated with
that empty <a>named flow</a>
and, consequently,
its children are not formatted visually.
<div class=note><span class=note-prefix>Note </span>
At the time of this note-writing, the <code>display</code> values that
always result in a non-replaced block container include
<code>block</code>, <code>inline-block</code>, <code>table-cell</code>,
<code>table-caption</code>, and <code>list-item</code>. All of these
display values work as regions with non-replaced elements.
The <code>flex</code> and <code>grid</code> display values do not
result in block containers (they are defined as flex containers and grid
elements, respectively). So ‘<a href="#flow-from"><code
class=property>flow-from</code></a>’ combined with those display values
does not result in a <a>CSS Region</a>.
<a>CSS Regions</a>
create a new
<a href="">stacking context</a>.
<a>CSS Regions</a>
establish a new
<a href="">block formatting Context</a>.
Exclusions (see [[CSS3-EXCLUSIONS]])
potentially impact the content
laid out in <a>region chains</a>,
just as for non-regions.
<div class="note"><span class="note-prefix">Note </span>
With <a>region chains</a>,
an element may be split across multiple boxes
and these boxes may overlap
(for example if they are absolutely positioned).
So fragments of the same element
can overlap each other.
Since each element has a single z-index,
it would be required to find another mechanism
to decide in which order
the fragments are rendered.
Since each <a>CSS Region</a> creates
a new stacking context,
it is clear that each fragment is rendered separately
and their rendering order follows
the regular CSS rendering model.
Fragments rendering separately
is also relevant to elements that might normally
be rendered as a unit
(for example,
an element with its own stacking context,
or with transparency).
Each fragment of these elements
is separately contained in the stacking context
created by the <a>CSS Region</a>,
so each fragment of these elements
is rendered separately.
See the
<a href="#regions-visual-formatting-details">regions visual formatting details</a>
section for a description of how
'width' and 'height' values are resolved
for <a>CSS Region</a> boxes.
<h4 id="circular-dependencies">
Cycle Detection</h4>
<a>named flows</a> containing elements
where the value of 'flow-from' computes to an
<a href="">&lt;ident&gt;</a>
can produce nonsensical circular relationships,
such as a <a>named flow</a>
containing <a>CSS Regions</a>
in its own <a>region chain</a>.
These relationships can be easily
and reliably detected and resolved, however,
by keeping track of a dependency graph
and using common cycle-detection algorithms.
The dependency graph consists of edges such that:
Every <a>named flow</a> depends on its elements
where the value of 'flow-from' computes to an
<a href="">&lt;ident&gt;</a>.
Every element in a <a>named flow</a>
where the value of 'flow-from' computes to an
<a href="">&lt;ident&gt;</a>
depends on the <a>named flow</a> with the
<a href="">&lt;ident&gt;</a>
If the graph contains a cycle,
any elements where the value of 'flow-from'
computes to an
<a href="">&lt;ident&gt;</a>
participating in the cycle
do not become <a>CSS Regions</a>.
<div class="note"><span class="note-prefix">Note </span>
For example, styling like this:
#id {
flow-into: foolish;
flow-from: foolish;
would move the <code>#id</code> element to a "foolish" <a>named flow</a>,
and try to make the <code>#id</code> element
a <a>CSS Region</a> for the "foolish" <a>named flow</a>.
The "foolish" <a>named flow</a> would then contain its own region,
creating a cycle.
So the <code>#id</code> element does not become a <a>CSS Region</a>.
<div class="note"><span class="note-prefix">Note </span>
The content keyword can be used to break cycles in some circumstances:
#id {
flow-into: not-so-foolish content;
flow-from: not-so-foolish;
Here only the contents of the <code>#id</code> element are moved to the <a>named flow</a>, and the box for the <code>#id</code> element <em>does</em> become a <a>CSS Region</a>. Since the <a>named flow</a> does not contain the element itself, there is no cycle. With this declaration the <code>#id</code> element becomes a single-box <a>region chain</a> for its contents, and other boxes could be added to the chain to customize overflow.
<h4 id="fragmenting-regions">
Nested fragmentation contexts</h4>
A <a>CSS Region</a> that contains
a fragment of a <a>named flow</a>
can itself be fragmented if it is nested
within a fragmentation context [[!CSS3-BREAK]],
such as when a layout
using a <a>region chain</a> is printed.
In these cases break opportunities
in the named flow fragment
contained by the <a>CSS Region</a>
are determined using the standard
<a href="">fragmentation rules</a>.
In other words,
each region box and its associated fragment
should break as if it were a simple div
containing the fragment contents.
This can be controlled by using
an avoid break value on the <a>CSS Region</a>,
if that is desired.
A <a>CSS Region</a> can be part
of the contents of a separate named flow,
as long as there are no cycles broken
by the <a href="#circular-dependencies">Cycle Detection</a>
described above.
This case is a <dfn>nested region context</dfn>,
which has an effect
on the <a href="#regions-visual-formatting-steps">Visual Formatting Steps</a>
described below.
<h3 id="region-flow-break">
Controlling Region Flow Breaks</h3>
Fragmentation across regions can be controlled with the
'break-inside', 'break-before', and 'break-after' properties:
the generic values ''break-before/auto'', ''break-before/always'', and ''break-before/avoid''
affect content flowed through regions just as they do content flowed through columns or pages,
and the ''break-before/region'' and ''break-before/avoid-region'' values
provide region-specific breaking controls.
See [[CSS3-BREAK]] for details.
<h3 id="the-region-fragment-property">
The region-fragment property</h3>
<pre class='propdef'>
Name: region-fragment
Value: auto | break
Initial: auto
Applies To: <a>CSS Regions</a>
Inherited: no
Computed Value: specified keyword
Animation type: discrete
ISSUE: The 'continue' property in [[css-overflow-3]] is likely to replace this property.
The 'region-fragment' property controls the behavior
of the <a>last usable region</a>
associated with a <a>named flow</a>.
Content flows as it would in a regular content box.
If the content exceeds the container box,
it is subject to the
<a href= "">overflow</a>
property's computed value on the <a>CSS Region</a>.
Region breaks must be ignored on the <a>last usable region</a>.
If the content fits within the <a>CSS Region</a>,
then this property has no effect.
If the content does not fit within the <a>CSS Region</a>,
the content breaks as if flow was going to continue in a subsequent region.
See the <a href= "#regions-flow-breaking-rules">breaking rules</a> section.
A forced region break takes precedence over a natural break point.
Flow content that follows the last break in the <a>last usable region</a> is not rendered.
The 'region-fragment' property does not influence
the size of the region it applies to.
The following code sample illustrates
the usage of the 'region-fragment' property.
<div class="example">
article {
flow-into: article-flow;
#region-1, #region-2 {
flow-from: article-flow;
<strong>region-fragment: break;</strong> /* or auto */
<strong>overflow: visible;</strong> /* or hidden */
&lt;div id="region-1"&gt;&lt;/div&gt;
&lt;div id="region-2"&gt;&lt;/div&gt;
<table style="border: 1px solid gray;width: 100%;">
<td>article with two<br>
overflowing lines</td>
<td><code>region-fragment: break<br>
overflow: visible</code></td>
<td><code>region-fragment: auto<br>
overflow: visible</code></td>
<td rowspan="3" style="vertical-align: top;"><img src=
"images/region-overflow-flow.png" alt=
"flow content rendering"></td>
<td><img src="images/region-overflow-break-visible.png" alt=
"rendering with region-fragment:break and overflow:visible"></td>
<td><img src="images/region-overflow-auto-visible.png"
alt="rendering with region-fragment:auto and overflow:visible"></td>
<td><code>region-fragment: break<br>
overflow: hidden</code></td>
<td><code>region-fragment: auto<br>
overflow: hidden</code></td>
<td><img src="images/region-overflow-break-hidden.png" alt=
"rendering with region-fragment:break and overflow:hidden"></td>
<td><img src="images/region-overflow-auto-hidden.png"
alt="rendering with region-fragment:auto and overflow:hidden"></td>
Combinations of region-fragment and overflow.
<div class="note"><span class="note-prefix">Note </span>
The 'overflow' property is honored on a region:
if region content overflows,
such as the borders of elements
on the last line,
the 'overflow' property controls
the visibility of the overflowing content.
See the 'overflow' property definition ([[CSS21]]).
<h2 id="cssom_view_and_css_regions">
Since content may flow into multiple regions,
authors need a way to determine if there are enough regions
to flow all the content from a named flow.
This is especially important considering that the size of regions
or the size of the content may change depending on the display context.
For example,
flowing the same content on a mobile phone with a small screen
may require more regions than on a large desktop display.
Another example is the user changing
the font size of text flowing through regions.
Depending on the change,
new regions may be needed to accommodate for the additional space required
to fit the larger text or some regions may need to be removed for smaller text.
<h3 id="the-namedflow-interface">
The NamedFlow interface</h3>
The following APIs allow scripts
to reference a <a idl>NamedFlow</a>
object representation of a <a>named flow</a>.
An additional attribute on the
<a href= "">
<code class= "idl">Document</code></a>
interface provide access to <a>named flows</a>.
<pre class="idl">
partial interface Document {
readonly attribute NamedFlowMap namedFlows;
<dfn id="document-namedflows"><code class="idl">namedFlows</code></dfn>
attribute on the
<a href= "">
<code class= "idl">Document</code>
interface returns a static snapshot
of all the current <a>named flows</a>
in the document.
The <dfn attribute for="Document"><code class="idl">namedFlows</code></dfn>
map must include all <a>named flows</a>
that are currently in the <code>CREATED</code> state.
The list must not include <a>named flows</a>
that are in the <code>NULL</code> state.
interface provides a map of current
<a idl>NamedFlow</a> instances
in the document.
The <a idl>NamedFlowMap</a> object
is a snapshot of the data,
and is read-only.
<pre class="idl">
[Exposed=Window] interface NamedFlowMap {
maplike&lt;CSSOMString, NamedFlow&gt;;
The map entries in a
<a idl>NamedFlowMap</a> object
are the named flow idents
paired with their
<a idl>NamedFlow</a> objects.
The <dfn method for="NamedFlowMap">get()</dfn>
and <dfn method for="NamedFlowMap">has()</dfn>
methods return null and false respectively
if there is no <a idl>NamedFlow</a>
with the given ident.
The <dfn method for="NamedFlowMap">set()</dfn>
and <dfn method for="NamedFlowMap">delete()</dfn>
methods always throw an
<code>InvalidAccessError</code> exception,
as this map is read-only.
The <a idl>NamedFlowMap</a> interface
uses the rest of the default map
<a href="">class methods</a>.
The {{NamedFlow}}
interface offers a representation
of a <a>named flow</a> instance.
The <a idl>NamedFlow</a> interface
can be used for different purposes.
For example, the <code>getRegionsByContent()</code> method
can help navigate by bookmark:
a script can find the <a>CSS Regions</a>
that display a particular anchor
and bring them to view.
Likewise, the interface allows authors
to check if all content has been fitted
into existing regions.
If it has, the <a idl>overset</a> attribute
would be false.
<pre class="idl">
interface NamedFlow : EventTarget {
readonly attribute CSSOMString name;
readonly attribute boolean overset;
sequence&lt;Element&gt; getRegions();
readonly attribute short firstEmptyRegionIndex;
sequence&lt;Node&gt; getContent();
sequence&lt;Element&gt; getRegionsByContent(Node node);
The <dfn attribute for="NamedFlow"><code class="idl">name</code></dfn> attribute
returns the name of the <a idl>NamedFlow</a> instance.
The <dfn attribute for="NamedFlow"><code class="idl">overset</code></dfn>
attribute returns true
if there are <a>named flow</a> fragments
that do not fit
in the associated <a>region chain</a>
(including the case where
there are <a>named flow</a> fragments
but no regions in the <a>region chain</a>).
Otherwise, it returns false.
The <dfn method for="NamedFlow"><code class="idl">getRegions()</code></dfn>
method returns the sequence
of regions in the <a>region chain</a>
associated with the <a>named flow</a>.
Regions after the <a>last usable region</a>, if any, are included.
Note that the returned values
is a static sequence
in document order.
The <dfn attribute for="NamedFlow">firstEmptyRegionIndex</dfn>
is the index of the first region
in the <a>region chain</a> with the <code>regionOverset</code> attribute
set to <code>empty</code>.
If all regions have the <code>regionOverset</code> attribute
set to <code>fit</code> or <code>overset</code>,
the value for <code>firstEmptyRegionIndex</code> is <code>-1</code>.
If there are no regions in the <a>region chain</a>,
the value is <code>-1</code> as well.
The <dfn method for="NamedFlow">getContent()</dfn>
method returns an ordered collection
of nodes that constitute the <a>named flow</a>.
The returned list is a static snapshot
of the <a>named flow</a> content
at the time the method is invoked.
This list contains the contents
that were moved to the <a>named flow</a>
by the flow-into property
but not any descendants
(unless the descendants are themselves
moved to the <a>named flow</a>).
The <dfn method for="NamedFlow">getRegionsByContent()</dfn>
method returns the sequence of regions
that contain at least part
of the target content node
if it belongs to the <a>named flow</a> directly
or one of its ancestors belongs to the <a>named flow</a>.
Otherwise, the method returns
an empty sequence.
The returned value
is a static sequence
in document order.
The <a>named flow</a> states are :
<code class="idl">NULL</code>: the <a>named flow</a>
contains no content and has no <a>region chain</a>.
<code class="idl">CREATED</code>: the <a>named flow</a>
either contains content or has a <a>region chain</a>.
A <a idl>NamedFlow</a> object is live:
it always represents the <a>named flow</a>
with the corresponding name even if
that <a>named flow</a> has transitioned
to the <code>NULL</code> state.
<h3 id="the-region-interface">
The Region mixin</h3>
{{Region}} is a
<a href="">mixin</a>
which must be included by all interfaces
(<a href="">
<code class= "idl">Elements</code></a>,
pseudo-elements or other CSS constructs
such as <a href="">slots</a>) in an implementation which can be <a>CSS Regions</a>.
<pre class="idl">
interface mixin Region {
readonly attribute CSSOMString regionOverset;
sequence&lt;Range&gt;? getRegionFlowRanges();
Element includes Region;
The <dfn attribute for="Region"><code class= "idl">regionOverset</code></dfn>
attribute returns one of the following values:
The region is the <a>last usable region</a> in the
<a>region chain</a> and
not able to fit the remaining content from the <a>named flow</a>.
Note that the region's
<a href= "">
<code class= "idl">overflow</code></a>
property value can be used to control the
visibility of the overflowing content and the
'region-fragment' property controls whether or not fragmentation happens
on the content that overflows the <a>last usable region</a>.
The region's flow fragment content
fits into the region's
<a>content box</a>.
If the region is the <a>last usable region</a>
in the <a>region chain</a>,
it means that the content
fits without overflowing.
If the region is not the <a>last usable region</a>
in the <a>region chain</a>,
that means the <a>named flow</a> content
may be further fitted in subsequent regions.
In this last case,
note that the <a>named flow</a> fragment may be empty
(for example if the region is too small
to accommodate any content).
This value is returned if the <a idl>Region</a> object
is not (or no longer) a region.
All content from the <a>named flow</a> was fitted in prior regions.
If there is no content
in the <a>named flow</a>,
all regions associated
with that <a>named flow</a>
should have their <a idl>regionOverset</a>
attribute return ''empty''.
If there is content in the flow
but that content does not
generate any box for visual formatting,
the ''overset'' attribute on the first region
in the <a>region chain</a> associated
with the flow will return ''fit''.
The <dfn method for="Region">getRegionFlowRanges()</dfn> method
returns an array of <a href= "">Range</a>
instances corresponding to fragment
from the <a>named flow</a>
that is laid out in the region.
If the region has not received a fragment
because it is too small to accommodate any,
the method returns a single <a idl>Range</a>
where the <code>startContainer</code>
and <code>startOffset</code>
have the same values as
the <code>endContainer</code>
and <code>endOffset</code>
and therefore the collapsed attribute
on the <a idl>Range</a> is true.
In that situation,
if the region is the first
in the <a>region chain</a>,
the <code>startContainer</code>
is the first <code>Node</code>
in the <a>named flow</a>
and the <code>startOffset</code> is zero.
If the region is the <a>last usable region</a>
in the <a>region chain</a>
(but not the first and only one),
the <code>startContainer</code>
and <code>startOffset</code>
are the same values as
the <code>endContainer</code>
and <code>endOffset</code>
on the previous region
in the <a>region chain</a>.
The method returns null
if the <span>region</span> object
is not (or no longer) a region.
A <a idl>Region</a> instance
may represent an object
that is no longer a <span>region</span>.
This may happen for example
if the 'flow-from' property
on the corresponding pseudo-element,
element or other construct
becomes ''flow-from/none''
but a script is still holding
a reference to the <a idl>Region</a> object.
<h3 id="named-flow-events">
Named flow events</h3>
<a idl>NamedFlow</a>
objects are <a href="">EventTargets</a>
which dispatch the following events
for their respective triggers.
These events are asynchronous,
and fire at the end of the
<a href="#named-flows-layout">regions visual formatting</a>
The regionfragmentchange event is dispatched
on any change to a named flow's fragmentation through its <a>region chain</a>,
including changes to any overset fragment.
<table class="event-desc" style="border: 1px solid gray">
<tr class="assert must"><th>Type</th>
<td class="eventname"><strong><code>regionfragmentchange</code></strong></td>
<tr class="assert must"><th>Interface</th>
<td><code><a href="">UIEvent</a></code> (see [[!DOM-LEVEL-3-EVENTS]])</td>
<tr class="assert must"><th>Sync / Async</th> <td>Async</td></tr>
<tr class="assert must"><th>Bubbles</th> <td>No</td></tr>
<tr class="assert must"><th>Target</th>
<td><a idl>NamedFlow</a></td>
<tr class="assert must"><th>Cancelable</th> <td>Yes</td></tr>
<tr class="assert must"><th>Default action</th> <td>none</td></tr>
<tr class="assert must"><th>Context info</th>
<li><code class="attribute-name"></code>:
<a idl>NamedFlow</a> whose fragmentation has changed.
The regionoversetchange event is dispatched
if any of the regionOverset values change
in a named flow's <a>region chain</a>,
including when regions are added or removed from the chain.
<table class="event-desc" style="border: 1px solid gray">
<tr class="assert must"><th>Type</th>
<td class="eventname"><strong><code>regionoversetchange</code></strong></td>
<tr class="assert must"><th>Interface</th>
<td><code><a href="">UIEvent</a></code> (see [[!DOM-LEVEL-3-EVENTS]])</td>
<tr class="assert must"><th>Sync / Async</th> <td>Async</td></tr>
<tr class="assert must"><th>Bubbles</th> <td>No</td></tr>
<tr class="assert must"><th>Target</th>
<td><a idl>NamedFlow</a></td>
<tr class="assert must"><th>Cancelable</th> <td>Yes</td></tr>
<tr class="assert must"><th>Default action</th> <td>none</td></tr>
<tr class="assert must"><th>Context info</th>
<li><code class="attribute-name"></code>:
<a idl>NamedFlow</a> whose <a>region chain</a> has regionOverset values that have changed.
<h3 id="cssomview-and-regions">
Clarifications on pre-existing APIs</h3>
<h4 id="cssomview-getclientrects-and-getboundingclientrect">
<code class="idl">getClientRects()</code> and <code>getBoundingClientRect()</code></h4>
The <a href="">CSSOM View Module</a>
defines how user agents compute
the bounding client rectangle
for an element (<code class="idl">getBoundingClientRect()</code>)
and its generated boxes (<code class="idl">getClientRects()</code>).
This definition applies to
the (possibly) multiple boxes
generated for an element in a named flow
flowing through a <a>region chain</a>.
The <code class="idl">getClientRects()</code> method
returns the list of boxes generated
for each of the element fragments
laid out in different regions.
The <code>getBoundingClientRect()</code> method
operates as specified in the
<a href="">CSSOM View Module</a>
as well and is computed
from the set of rectangles
returned by <code class="idl">getClientRects()</code>.
<h4 id="cssomview-offset-attributes">
<code class="idl">offsetTop</code>, <code class="idl">offsetLeft</code>,
<code class="idl">offsetWidth</code>, <code class="idl">offsetHeight</code> and <code class="idl">offsetParent</code></h4>
The computation of the
<a href="">offset attributes</a>
for elements laid out in a <a>named flow</a> follow the
<a href="">specification</a>
For the purpose of these algorithms,
the <em>first CSS layout box</em> associated
with an element laid out in a <a>named flow</a>
is the first box generated for the first region the element is laid out into.
In the offsetParent algorithm,
the nearest ancestor search skips
from the topmost named flow elements directly to the body element.
<h2 id="multi-column-regions">
Multi-column regions</h2>
<a href="">multi-column</a>
element can be
assigned to a <a>region chain</a>.
The element becomes part
of the <a>region chain</a>
for the associated <a>named flow</a>,
and flows its content fragments
through columns according to
the multi-column specification
In particular,
when computing the
<a href="#rfcb-flow-fragment-height-resolution">flow fragment height</a>
of a multi-column container
that is associated with a <em><a>named flow</a></em>,
the 'column-fill'
property is honored
to balance the fragments of content
that would flow through
its columns.
Overflow of multicol regions
is mostly handled
according to the same rules
as other <a>CSS Regions</a>.
If the remainder of the named flow
does not fit
in the multicol region,
then the rest
of the content flows into
the remaining <a>region chain</a>.
if a multicol region
is the <a>last usable region</a>
in a <a>region chain</a>,
then the multicol region must follow the
<a href="">overflow column rules</a>
<div class="example">
The following example:
article {
flow-into: article-flow;
#multi-col {
column-count: 2;
flow-from: article;
height: 6em;
column-gap: 1em;
#remainder {
flow-from: article;
height: auto;
&lt;div id="multicol"&gt;&lt;/div&gt;
&lt;div id="remainder"&gt;&lt;/div&gt;
is equivalent in rendering to, for example:
article {
flow-into: article-flow;
#flex {
display: flex;
flex-pack: justify;
height: 6em;
#flex > div {
flow-from: article;
width: calc(50% - 0.5em);
#remainder {
flow-from: article;
height: auto;
&lt;div id="flex"&gt;
&lt;div /&gt;
&lt;div /&gt;
&lt;div id="remainder"&gt;&lt;/div&gt;
<h2 id="pseudo_elements">
It can be useful
to visually mark the content
to highlight that a content thread
is flowing through the <a>region chain</a>.
For example, a marker
such as <em>'continued below'</em> clearly indicates,
at the end of a <a>CSS Region</a>,
that there is more content in the flow
which can be found by scrolling past
whatever content interrupts the <a>region chain</a>.
The '::before' and '::after' pseudo-elements (see [[!SELECT]])
let content authors mark the beginning
and end of a region with such markers.
<h2 id="regions-visual-formatting-details">
Regions visual formatting details</h2>
Regions are laid out by CSS and take part in the normal box model and other layout models
offered by CSS modules such as flexible boxes ([[CSS3-FLEXBOX]]). However, <span>regions</span>
lay out a fragment of their <a>named flow</a> instead of laying out descendant content as happens with other
This section describes the model for laying out <span>regions</span>
and for laying out <a>named flow</a> content into regions.
The descriptions in this section are biased towards a horizontal writing mode,
using ''width'' for logical width (or measure)
and ''height'' for logical height (or extent)
as <a href="">defined</a>
in the CSS Writing Modes Module [[!CSS3-WRITING-MODES]]).
To use this model in a vertical writing mode apply the principles
<a href="">described</a>
in that specification.
<h3 id="processing-model">
Processing model</h3>
The '::before' content is laid out
in the region prior to
any other content coming from the flow.
The '::after' content is laid out
in the region after laying out
the flow fragment content into the <span>RFCB</span>.
Then, flow content is removed from the fragment
to accommodate the '::after' content.
Accommodating means that the '::after' content
is laid out without overflowing the region.
If there is not enough room to accommodate
the ::before content,
the '::after' content after removing all flow fragment content,
or a combination of the two,
then the ::before and/or ::after content overflows that region.
<h3 id="regions-flow-content-box">
The Region Flow Content Box (RFCB)</h3>
A region box lays out the following boxes:
The boxes generated by its <code>::before</code> and
<code>::after</code> pseudo-elements, if any.
The anonymous <dfn>region flow content box</dfn>
(called <dfn>RFCB</dfn> in this document)
which contains the fragment of the <a>named flow</a>
that the region receives.
<img src="images/RFCB.svg" width=600 alt="The ::before, RFCB and ::after boxes contained in the Region Box"/>
The Region Flow Content Box (RFCB)
Laying out a <span>region</span> box follows the same processing rules
as for any other <a href="">block container box</a>.
The <span>RFCB</span> is a
<a href="">block container box</a>
with a computed 'width' of ''width/auto'' and whose used 'height' is resolved as detailed below.
Since the <span>RFCB</span> is a <a href="">block container box</a>, the ::before box and ::after box will also be block containers, though the contents of ::before and ::after may be inline within those boxes.
<h4 id="rfcb-width-resolution">
RFCB 'width' resolution</h4>
At various points in the visual formatting of documents containing regions,
the used 'width' of RFCBs and regions need to be resolved.
In all cases, the resolution is done following the rules for
<a href="">calculating widths and margins</a> (see [[!CSS21]]).
Sometimes, resolving the used 'width' value requires
measuring the content's <code>min-content</code>
and <code>max-content</code> values
(as <a href="">defined</a>
in the CSS Writing Modes Module [[!CSS3-WRITING-MODES]]).
or an RFCB, <strong>these measures are made
on the <em>entire</em> associated <a>named flow</a> content</strong>.
As a consequence,
all <span>RFCBs</span> of <span>regions</span> associated
with a given <a>named flow</a>
share the same <code>min-content</code>
and <code>max-content</code> measures.
This approach is consistent with the
<a href="">box model for breaking</a> ([[!CSS3-BREAK]]).
<h3 id="regions-visual-formatting-steps">
Regions visual formatting steps</h3>
Formatting documents that contain <a>named flows</a> laid out in regions
is a three-step process:
<em>Step 1: RFCB <dfn>flow fragment height</dfn> resolution</em>.
In this step, the heights of fragments fitting in the regions' RFCBs are resolved.
<em>Step 2: document and regions layout</em>.
In this step, the document content and regions are laid out.
However, <a>named flow</a> content is not laid out in regions yet.
<em>Step 3: <a>named flow</a> layout</em>.
In this step, the content of <a>named flows</a>
is laid out in their respective <a>region chains</a>.
<img src="images/regions-layout-three-steps.svg" width=600 alt="visual representation of the three-step process"/>
Regions visual formatting steps
<h4 id="rfcb-flow-fragment-height-resolution">
Step 1: RFCB flow fragment height resolution</h4>
Conceptually, resolving the flow fragment height is a two phase process.
<h5 id="rfcb-flow-fragment-height-resolution-phase-1">
RFCB flow fragment height resolution, Phase 1</h5>
The document is laid out with a
<a href="">used</a> height of zero
for all <span>RFCB</span>s. In this phase, the content of <a>named flows</a> is not laid out in
<span>regions</span>. This phase yields resolved position and sizes for all regions and
their RFCBs in the document.
<h5 id="rfcb-flow-fragment-height-resolution-phase-2">
RFCB flow fragment height resolution, Phase 2</h5>
<a>named flows</a> are laid out in <span>regions</span>.
The user agent resolves
the <em><span>flow fragment height</span></em>
for the <span>RFCB</span>s
using the remainder of the flow
and accounting for <a href="">fragmentation rules</a>.
This process accounts for constraints
such as the 'height' or 'max-height' values,
as described in the CSS 2.1 section
on <a href="">calculating heights and margins</a>
(see the <a href="">Block-level non-replaced elements in normal flow...</a>
section and the <a href="">complicated cases</a> section).
During this phase,
generated content is laid out
according to the <a href="#processing-model">rules</a>
described earlier in this document.
In a <a>nested region context</a>,
this phase will trigger
the beginning of Step 1
for any inner <a>named flows</a>
whose regions are contained
in the outer <a>named flow</a>.
All of Step 1 for inner flows
must recursively complete before Step 1
for an outer flow completes.
<h4 id="regions-boxes-layout">
Step 2: region boxes layout</h4>
In this step, the document is laid out according to the normal CSS layout rules.
If a measure of the content is required to resolve the used 'width' of the region box,
the value is resolved as described in the
<a href="#rfcb-width-resolution">RFCB width resolution</a> section.
If a measure of the content is required to resolve the used height of the RFCB
(for example if the region box is absolutely positioned),
the <span>flow fragment height</span> resolved in Step 1 is used
for the vertical content measure of the RFCB.
At the end of this step,
regions are laid out and ready to receive content
from their associated <a>named flows</a>.
<h4 id="named-flows-layout">
Step 3: named flows layout</h4>
In this final step,
the content of <a>named flows</a>
is laid out in the <span>regions</span>' RFCBs
along with the generated content boxes.
The used 'width' for RFCBs is resolved
<a href="#rfcb-width-resolution">as described before</a>.
The used 'height' of RFCBs is resolved
such that none of the boxes
in the region box's normal flow
overflow the region's box.
In other words,
the RFCB boxes are stretched vertically
to accommodate as much
of the flow as possible
without overflowing the region box
and accounting for
<a href="">fragmentation rules</a>
and generated content boxes.
During this phase,
generated content is laid out
according to the <a href="#processing-model">rules</a>
described earlier in this document.
In a <a>nested region context</a>,
this step will trigger Step 2
for inner <a>named flows</a>
whose regions are contained
in the outer <a>named flow</a>.
Fragmentation of the inner regions
may result as they are laid out
in the outer <a>region chain</a>.
Once Step 3 for an outer named flow is complete,
Step 3 for the inner <a>named flows</a> recursively begins.
Once Step 3 for a named flow is complete,
The conditions for the
<a href="#named-flow-events">named flow events</a> are checked,
and if the triggers are met
the events dispatch at this point.
<div class="note"><span class="note-prefix">Note </span>
The model for resolving auto sized regions will cause,
under certain circumstances,
the flow content to be overset or underset.
In other words,
it will not fit tightly.
The model prevents having circular dependencies
in the layout model.
Implementations may decide to apply
further layout steps
to ensure that the whole flow content
is displayed to the user,
even in edge cases.
<h3 id="regions-visual-formatting-implementation-note">
Regions visual formatting: implementation note</h3>
The process for resolving an RFCB's 'height' and the three-step process used to
lay out documents containing regions and <a>named flows</a> are
<em>conceptual</em> descriptions of what the layout
should yield and implementations should optimize to reduce the number of
steps and phases necessary wherever possible.
<h3 id="regions-visual-formatting-examples">
Regions visual formatting example</h3>
This section is non-normative.
This example considers a document where content flows between three regions,
and region boxes are intermixed with the normal document content.
<div class="example">
article {
flow-into: article;
#rA, #rB, #rC {
flow-from: article;
height: auto;
margin: 1em 1em 0em 1em;
padding: 1em;
border: 3px solid #46A4E9;
#rA {
width: auto;
#rB {
float: left;
width: 15em;
max-height: 150px;
#rC {
float: right;
width: 12em;
#main-flow {
padding: 0em 1em 0em 1em;
&lt;p style="break-after:region;"&gt;I am not a ... &lt;/p&gt;
&lt;div id="rA"&gt;&lt;/div&gt;
&lt;div id="rB"&gt;&lt;/div&gt;
&lt;div id="rC"&gt;&lt;/div&gt;
&lt;div id="main-flow"&gt;
&lt;p&gt;Lorem ipsum dolor ...&lt;/p&gt;
The following sections and figures illustrate the intermediate results
for the visual formatting process.
In the following, we call RFCB-A, RFCB-B and RFCB-C
the <span>RFCBs</span> for regions rA, rB and rC respectively.
<h4 id="step1-phase1-example">
Step 1 - Phase 1: Laying out RFCBs with used height of zero</h4>
Applying the rules for Step 1, Phase 1,
the computed ''width/auto'' 'width' values for the RFCBs are resolved
to used values according to the normal
<a href="">CSS layout rules</a>
meaning they stretch to the width
of their containing block's content box.
<li>RFCB-A: stretches to fit the rA content box.
<p>Since rA also has an ''width/auto'' 'width', its own used 'width' is stretched to fit the
<code>&lt;body&gt;</code> content box.</p>
<li>RFCB-B: stretches to fit the <code>rB</code> content box.</li>
<li>RFCB-C: stretches to fit the <code>rC</code> content box.</li>
Also applying the rules for Step 1, Phase 1,
the used values for the RFCBs 'height' properties are all zero.
Conceptually, this produces the layout illustrated below.
<img src="images/flow-fragment-height-phase-1.png" width=500 alt="Step 1 - Phase 1: Layout RFCBs with used heights of 0"/>
Step 1 - Phase 1: Layout RFCBs with used heights of 0
<h4 id="step1-phase2-example">
Step 1 - Phase 2: Layout flow to compute the RFCBs' flow fragments heights</h4>
In this second phase of Step 1,
the named flow is laid out in <span>regions</span>
and the height of each fragment falling in each RFCB is computed.
The user agent lays out as much
of the flow into an area with RFCB-A's used 'width'.
rA's 'height' computes to ''width/auto''
and there is no vertical maximum height for RFCA's 'height'.
However, because there is a break after the first paragraph
in the "article" <code>named flow</code>,
only this first paragraph is laid out
in RFCB-A and FH-A (the flow fragment height for RFCB-A)
is resolved by laying out this first paragraph in the used 'width'.
At this point, the user agent lays out as much
of the remaining flow as possible in RFCB-B.
Because rB's 'max-height' computed value is "150px",
the user agent only lays out the "article" named flow
using RFCB-B's used 'width' until the point where
laying out additional content would cause RFCB-B to overflow rB's box.
The fragment height for RFCB-B is resolved: FH-B (<code>150px</code>).
Finally, the user agent lays out the remainder of the flow in RFCB-C.
Because rC has no other constraints and no region breaks,
the remaining content is laid out in RFCB-C's used 'width'.
This results in a resolved flow fragment height: FH-C.
<img src="images/flow-fragment-height-phase-2.png" width=370 alt="Step 1 - Phase 2: Measure flow fragments heights"/>
Step 1 - Phase 2: Measure flow fragments heights
<h4 id="step2-example">
Step 2: Layout document and regions without named flows</h4>
The used 'width' of RFCB-A, RFCB-B and RFCB-C
are resolved as in the previous step.
However, the 'height' is resolved differently.
Resolving the 'height' of rA
<a href="">requires a content measure</a>
which is FH-A (the flow fragment height for RFCB-A).
The 'height' of rB results from first computing its
<a href="">content measure</a>
and then applying the
<a href="">rules for max-height</a>.
Here, the vertical content measure evaluates to FH-B.
After applying the rules for 'max-height'
and accounting for margins, padding and borders,
the used 'height' of rB is resolved to LH-B
The 'height' of rC's box results from
<a href="">calculating its content measure</a>:
FH-C becomes rC's used 'height'.
<img src="images/regions-visual-formatting-step-2.png" width=370 alt="Step 2: Layout document and regions without named flows"/>
Step 2: Layout document and regions without <a>named flows</a>
<h4 id="step3-example">
Step 3: named flows layout</h4>
In this final step,
the <code>article</code> <a>named flow</a>
is laid out in its <a>region chain</a>.
The used 'width' for each of the RFCB
is resolved as in step 1 above.
The used 'height' for the RFCB is a result
of laying out the as much of the content
in the <span>region</span> without overflowing its content box
and following the <a href="">fragmentation rules</a>.
Because the computed 'width' of the RFCB has not changed
and the fragmentation rules applied are the same as in Phase 1, Step 2,
the used 'height' for RFCB-A, RFCB-B and RFCB-C
are LH-A, LH-B and LH-C, respectively.
There may be situations where the used 'height'
of RFCBs resolved in Step 3 are different
from the <span>flow fragment height</span>
computed in Step 1 Phase 2.
<img src="images/regions-visual-formatting-step-3.png" width=370 alt="Step 3: Final result after laying out named flows in regions"/>
Step 3: Final result after laying out <a>named flows</a> in regions
<h2 id="relation-to-document-events">
Relation to document events</h2>
The CSS Regions module does not alter
the normal processing of events
in the document tree.
In particular,
if an event occurs on an element
that is part of a <a>named flow</a>,
the <a href= "">event's bubble and capture phases</a>
happen following the document tree order.
<div class="note"><span class="note-prefix">Note </span>
This means that in most cases
<a>CSS Regions</a>
will not receive user events
that trigger on their named flow content.
Event handlers for named flow content can check
<code><a href="">getElementsFromPoint()</a></code> [[CSSOM-VIEW]]
to find the <a>CSS Region</a>
where the user event occurred.
Future versions of CSS-UI may provide
a more general solution for user event bubbling
where the stack of elements
at the event coordinates
<h2 id="relation-to-other-specifications">
Relation to other specifications</h2>
This specification is related to other specifications
as described in the references section.
In addition, it is related to the following specifications:
CSS Fragmentation Module Level 3 [[CSS3-BREAK]].
This module defines the rules for fragmenting content over multiple containers
and applies to <a>CSS Regions</a>
in addition to applying to multi-column and [=paged media=].
CSS Pagination Templates Module Level 3 [[CSS3-PAGE-TEMPLATE]].
This module defines a syntax to define layout templates
which can be used when paginating content.
The page templates use regions.
CSS Exclusions Module [[CSS3-EXCLUSIONS]].
This module defines a generic way to define exclusions
around which content can flow.
This can be seen as an extension to CSS floats.
In advanced layout designs,
it is expected that the CSS Exclusions module
will be commonly combined with the CSS Regions module.
CSS Line Grid Module [[CSS3-LINE-GRID]].
This module defines a concept of line grid
to align the position of lines in different elements.
The line grid functionality is related and needed
for aligning content flowing in separate regions.
<h2 id="usecases">
Use Cases</h2>
Use cases are described on
<a href="">these</a>
<a href="">pages</a>.
<h2 id="changes">
<h3 id="changes_from_Oct_9_2014">
Changes from <a href="">October 9<sup>th</sup> 2014</a> version</h3>
<li>Add animation type lines</li>
<li>Remove definition of break properties, since they're already defined in [[CSS3-BREAK]].</li>
<li>Mention effects of containment on regions.</li>
<h3 id="changes_from_Feb_18_2014">
Changes from <a href="">February 18<sup>th</sup> 2014</a> version</h3>
<li>Added three simpler examples to the introduction</li>
<li>Moved complex example to the <a href="">CSSWG wiki</a></li>
<li>Moved the effects of CSS containment to this specification from [[CSS-CONTAIN-1]].
<h3 id="changes_from_May_28_2013">
Changes from <a href="">May 28<sup>th</sup> 2013</a> version</h3>
<li>Removed region styling from this level</li>
<li>Changed ::region() to ::region</li>
<li>display:none elements do not become CSS Regions</li>
<li>Clarify accessibility interactions with flow-into</li>
<li>Change NamedFlowCollection to NamedFlowMap</li>
<li>Remove mention of run-in and clarify ::before and ::after block containers</li>
<li>Removed custom element syntax from examples</li>
<li>Changed NamedFlowCollection getters back to null when there is no NamedFlow.</li>
<li>Removed issue on user events and added note describing solution(s)</li>
<li>Changed type of NamedFlow.getContent() from NodeList to sequence&lt;Node&gt;</li>
<h3 id="changes_from_Aug_28_2012">
Changes from <a href="">August 28<sup>th</sup> 2012</a> version</h3>
<li>Changed @region rule to ::region() functional pseudo-element</li>
<li>Removed CSSRegionStyleRule (see above)</li>
<li>Tied named flow event triggers to visual processing model</li>
<li>Described how visual formatting of nested regions works</li>
<li>Added content and element keywords to flow-into</li>
<li>Added regionoversetchange event</li>
<li>renamed regionlayoutupdate to regionfragmentchange</li>
<li>Defined offsetParent interaction</li>
<li>Removed implication of DOM manipulation</li>
<li>Changed Appendix A to use custom element layout.</li>
<li>Noted change in pseudo-element generation with flow-from.</li>
<li>Changed case of regionlayoutupdate to match other events in [[DOM-LEVEL-3-EVENTS]].</li>
<li>Added section on fragmenting the fragmenters.</li>
<li>Added section on handling circular flow-from and flow-into situations.</li>
<li>Added alignment and justification to region styling properties.</li>
<li>Added timing for regionLayoutUpdate event.</li>
<li>Clarified interaction between content and flow-from for pseudo-elements.</li>
<li>Changed NamedFlowCollection getters to return undefined when there is no NamedFlow.</li>
<li>Changed region-overflow property to region-fragment.</li>
<h3 id="changes_from_May_03_2012">
Changes from <a href="">May 3<sup>rd</sup> 2012</a> version</h3>
<li>Removed exceptions from the Region interface.</li>
<li>Changed NamedFlowCollection from live to a static snapshot.</li>
<li>Changed NamedFlow to inherit from EventTarget.</li>
<li>Removed flowFrom from Region interface and changed method name to getComputedRegionStyle().</li>
<li>Region interface is now a supplemental interface with the [NoInterfaceObject] extended attribute.</li>
<li>Added note for regionLayoutUpdate dispatching in nested flows.</li>
<li>Removed Document.getFlowByName() in favor of NamedFlowCollection.namedItem().</li>
<li>Changed to overset:false for NULL NamedFlow.</li>
<li>Changed regionLayoutUpdate to not bubble.</li>
<h3 id="older_changes">Older Changes</h3>
Older changelogs are <a href="">archived</a> on the CSSWG wiki.
<h2 class="no-num" id="acknowledgments">
The editors are grateful to the CSS working group
for their feedback and help with the genesis of this specification.
In addition, the editors would like to thank
the following individuals for their contributions,
either during the conception of CSS Regions
or during its development and specification review process:
Erik Arvidsson,
Tab Atkins,
Catalin Badea,
Mihai Balan,
Andrei Bucur,
Razvan Caliman,
Alexandru Chiculita,
Phil Cupp,
Arron Eicholz,
John Jansen,
CJ Gammon,
Dimitri Glazkov,
Daniel Glazman,
Arno Gourdol,
Catalin Grigoroscuta,
David Hyatt,
Brian Heuston,
Ian Hickson,
Jonathan Hoersch,
Michael Jolson,
Brad Kemper,
Håkon Wium Lie,
Kang-Hao (Kenny) Lu,
Mihai Maerean,
Markus Mielke,
Robert O'Callahan,
Theresa O'Connor,
Mihnea Ovidenie,
Virgil Palanciuc,
Olga Popiv,
Christoph Päper,
Anton Prowse,
Florian Rivoal,
Peter Sorotokin,
Elliott Sprehn,
Radu Stavila,
Christian Stockwell,
Eugene Veselov,
Boris Zbarsky,
Stephen Zilles
and the CSS Working Group members.