8000 csswg-drafts/css-regions/Overview.src.html at 23b323e6309d81977d179b105db2a0a1665658f1 · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
2236 lines (1884 loc) · 72.4 KB

File metadata and controls

2236 lines (1884 loc) · 72.4 KB
<h1>CSS Regions Module Level 1</h1>
<pre class='metadata'>
Status: ED< 7FD /div>
Shortname: css-regions
Level: 1
Group: csswg
TR: http://www.w3.org/TR/css-regions/
ED: http://dev.w3.org/csswg/css-regions/
Editor: Rossen Atanassov, Microsoft Corporation, ratan@microsoft.com
Editor: Alan Stearns, Adobe Systems&#44; Inc., stearns@adobe.com
Former Editor: Vincent Hardy, Ado 103C3 be Systems&#44; Inc., vhardy@adobe.com
!Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;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: css21 (property) max-height
Ignored Terms: document, element, eventtarget
</pre>
<h2 id="introduction">
Introduction</h2>
<em>This section is non-normative.</em>
The core concept behind CSS Regions
is the ability to say,
"Display <em>this</em> content (a ''named flow'')
over <em>there</em> (a ''region chain'')."
The simplest example is:
<div class="example">
<pre><code class="css">
#this {
flow-into: my-flow;
}
#there {
flow-from: my-flow;
}
</code></pre>
</div>
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 ''named flow'',
and a single box for the ''region chain''.
Named flows can also have multiple sources
and use multiple boxes for the ''region chain''.
The ''named flow'' 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;
</code></pre>
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;
</code></pre>
<pre><code class="css">
article {
flow-into: article-flow;
}
.region {
flow-from: article-flow;
}
.top {
max-height: 80vh;
}
</code></pre>
So the top box in the ''region chain''
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"
src="images/linked-boxes-before.png"/>
<figcaption>
Rendering without CSS Regions
</figcaption>
</figure>
<figure style="float:left; margin:1em;">
<img alt="Article and aside rendering with CSS Regions"
src="images/linked-boxes-after.png"/>
<figcaption>
Rendering with CSS Regions
</figcaption>
</figure>
<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 ''region chain''
to regularly interleave other content with the article.
</div>
<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;
&lt;nav&gt;&lt;/nav&gt;
...some more links...
&lt;/div&gt;
</code></pre>
If the links in the main nav element are placed in a ''named flow'', that flow can be directed through both the main nav element and the overflow nav box in the menu:
<pre><code class="css">
nav a {
flow-into: nav-link-flow;
}
nav {
flow-from: nav-link-flow;
}
</code></pre>
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.
<figure>
<img alt="Wide nav bar showing all of the links"
src="images/menu-wide.png"/>
<figcaption>
Wide rendering with menu shown
</figcaption>
</figure>
<figure>
<img alt="Narrow nav bar with some of the links in the menu"
src="images/menu-narrow.png"/>
<figcaption>
Narrow rendering with menu shown
</figcaption>
</figure>
</div>
<div class="example">
Since content is assigned to a ''named flow'' 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;
</code></pre>
You can take the "breaking" stories and display them above all the others using two lines of CSS:
<pre><code class="css">
.breaking {
flow-into: breaking-news;
}
.breaking-news {
flow-from: breaking-news;
}
</code></pre>
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>
<div class="note"><span class="note-prefix">Note </span>
<strong>''CSS Regions'' are independent from layout</strong>
Any of the CSS layout facilities can be used
to create, position and size boxes that can become ''CSS Regions''.
The CSS Regions module does not
define a layout mechanism
and is meant to integrate
with existing and future CSS layout facilities.
</div>
<div class="note"><span class="note-prefix">Note </span>
<strong>''CSS Regions'' 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 ''CSS Region''
is that the 'flow-from' property applies to the box.
</div>
<h2 id="css-regions-concepts">
CSS Regions concepts</h2>
<h3 id="regions">
Regions</h3>
A <dfn>CSS Region</dfn>
is a block container
that has an associated
<em>''named flow''</em>
(see the 'flow-from' property).
<h3 id="region-chain">
Region chain</h3>
A <dfn>region chain</dfn>
is the sequence of regions
that are associated with
a ''named flow''.
''CSS Regions'' in a
region chain receive content from the
''named flow'' following their order in the chain.
''CSS Regions'' are organized
into a ''region chain''
according to the document order.
<h3 id="named-flow">
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 ''named flow'' are ordered
according to the document order.
Content is placed into a ''named flow''
with the 'flow-into' property.
The content in a ''named flow'' is laid out
in the ''region chain''
that is associated with this ''named flow''
using the 'flow-from' property.
Content from a ''named flow''
is broken up between regions
according to the regions flow breaking rules.
A ''named flow'' is created when
some content is moved
into the flow with the given identifier
or when at least one ''CSS Region''
requests content from that flow.
<h3 id="regions-flow-breaking-rules">
Regions flow breaking rules</h3>
Breaking a ''named flow'' across a region chain
is similar to breaking a document's content across pages
(see [[CSS3PAGE]])
or a multi-column element's content across column boxes
(see [[CSS3COL]]).
One difference is that page boxes are generated
based on the available content
whereas a region chain is a set of recipient boxes
for the ''named flow'' content
whose dynamic generation is not in the scope
of this specification.
Each ''CSS Region'' in turn
consumes content from its associated ''named flow''.
The ''named flow'' content is positioned
in the current region
until a natural or forced region break occurs,
at which point the next region
in the ''region chain''
becomes the current region.
If there are no more ''CSS Regions''
in the ''region chain''
and there is still content in the flow,
the positioning of the remaining content
is controlled by the 'region-fragment' property
on the last ''CSS Region'' 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">
Properties</h2>
<h3 id="the-flow-into-property">
The 'flow-into' property</h3>
<div class="issue-marker wrapper">
<div class="issue-marker">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16527">Issue-16527</a>
<div class="issue-details">
<p class="short-desc">[Shadow]: getFlowByName and shadow DOM</p>
</div>
</div>
</div>
The ‘flow-into’ property can place an element
or its contents
into a ''named flow''.
Content that belongs to the same flow
is laid out in the region chain
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="http://www.w3.org/TR/selectors/#pseudo-elements">pseudo-elements</a> such as <code class="css">::first-line</code>, <code class="css">::first-letter</code>, <code class="css">::before</code> or <code class="css">::after</code>.
Inherited: no
Computed Value: as specified
Media: visual
</pre>
<dl>
<dt>none</dt>
<dd>
The element is not moved
to a ''named flow''
and normal CSS processing takes place.
</dd>
<dt><a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a></dt>
<dd>
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="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&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 ''none'', ''inherit'', ''default'', ''auto'' and ''initial''
are invalid flow names.
</dd>
</dl>
The 'flow-into' property affects
the visual formatting of elements or contents
placed into a ''named flow''
and of the region chain laying out content
from a ''named flow''.
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="http://www.w3.org/TR/2012/WD-dom-20120405/#introduction-to-the-dom">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="http://www.w3.org/TR/css3-speech/">speech</a>).
Likewise, 'flow-into' does not affect
the default traversal order
of sequential navigation modes
(such as cycling through links,
see e.g. 'nav-index' [[CSS3UI]]
or <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#sequential-focus-navigation-and-the-tabindex-attribute"><code>tabindex</code></a> [[HTML40]]).
A ''named flow'' needs to be associated
with a region chain
(one or more ''CSS Regions'')
for its content to be visually formatted.
If no region chain is associated
with a given ''named flow'',
the content in the ''named flow''
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 ''named flow''
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 ''CSS region'' in a ''region chain''
establishes a containing block for absolutely positioned
elements in the ''named flow'' (see [[!CSS21]]).
That first ''CSS region'' in a ''region chain''
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 ''named flow''.
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="http://www.w3.org/TR/css3-writing-modes/#writing-mode">writing mode</a>
for the entire flow.
The writing mode
on subsequent regions is ignored.
<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"
''named flow''.
However, the
<pre>table &gt; * {flow-into: table-content} ...</pre>
selector will move all immediate children
of all table elements
into the "table-content" ''named flow''
(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" ''named flow'',
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 ''named flow''.
Having the descendants become siblings
in the ''named flow''
results in a different processing
(see <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#anonymous-boxes">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>
<div class="note"><span class="note-prefix">Note </span>
Another consequence of moving elements
into named flows is that surrounding whitespace
is not moved into the named flow.
If you have code like this:
<pre>
span {flow-into: span-content}
&lt;span&gt;one&lt;/span&gt;
&lt;span&gt;two&lt;/span&gt;
</pre>
Then the "span-content" named flow contents
will contain this:
<pre>
&lt;span&gt;one&lt;/span&gt;&lt;span&gt;two&lt;/span&gt;
</pre>
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.
</div>
<h3 id="the-flow-from-property">
The 'flow-from' property</h3>
The 'flow-from' property makes
a block container a region
and associates it with
a ''named flow''.
<pre class='propdef'>
Name: flow-from
Value: <<ident>> | none | inherit
Initial: none
Applies To: Non-replaced <a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes">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
Media: visual
</pre>
<dl>
<dt><strong>none</strong></dt>
<dd>
The block container is not a ''CSS Region''.
</dd>
<dt><strong><a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a></strong></dt>
<dd>
The block container becomes a ''CSS Region''
(except as detailed in the text below),
and is ordered in a ''region chain''
according to its document order.
The content from the flow
with the <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
name will be <a href="#region-flow-break">broken
into fragments</a> and visually formatted in the
<a href="http://www.w3.org/TR/CSS21/visuren.html#principal-box">principal boxes</a>
of the <span>regions</span>
in the ''region chain''.
<br/>
If there is no flow with name
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>,
then the block container does not
format any content visually.
</dd>
</dl>
If the 'content' property computes
to something else than ''normal''
(or ''none'' for a pseudo-element),
the block container does not become
a ''CSS Region''.
If the 'display' property
of the block container
or one of its ancestors
computes to ''none'',
the block container does not become
a ''CSS Region''.
A ''CSS Region''&rsquo;s document children
are not visually formatted
unless they are directed
to a ''named flow''
with an associated ''region chain''.
Block container pseudo-elements where
the value of 'flow-from' computes to an
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
and the value of 'content' computes to ''none''
are generated as ''CSS Regions'',
which is an update to the behavior
described in [[!CSS21]].
<div class="note"><span class="note-prefix">Note </span>
A block container becomes a ''CSS Region''
when its 'flow-from' property is set
to a valid <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a> value,
even if there is no content contributing
to the referenced flow.
For example:
<pre>
&lt;style&gt;
.article{
flow-into: thread;
}
.region{
flow-from: thread;
}
&lt;/style&gt;
&lt;html&gt;
&lt;body&gt;
&lt;div class=region&gt;div content&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
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 ''named flow''
and, consequently,
its children are not formatted visually.
</div>
<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 ''CSS Region''.
</div>
''CSS Regions''
create a new
<a href="http://www.w3.org/TR/CSS2/visuren.html#z-index">stacking context</a>.
''CSS Regions''
establish a new
<a href="http://www.w3.org/TR/CSS2/visuren.html#block-formatting">block formatting Context</a>.
Exclusions (see [[CSS3-EXCLUSIONS]])
potentially impact the content
laid out in region chains,
just as for non-regions.
<div class="note"><span class="note-prefix">Note </span>
With ''region chains'',
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 ''CSS Region'' 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 ''CSS Region'',
so each fragment of these elements
is rendered separately.
</div>
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 ''CSS Region'' boxes.
<h4 id="circular-dependencies">
Cycle Detection</h4>
''named flows'' containing elements
where the value of 'flow-from' computes to an
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
can produce nonsensical circular relationships,
such as a ''named flow''
containing ''CSS Regions''
in its own ''region chain''.
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:
<ul>
<li>
Every ''named flow'' depends on its elements
where the value of 'flow-from' computes to an
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>.
</li>
<li>
Every element in a ''named flow''
where the value of 'flow-from' computes to an
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
depends on the ''named flow'' with the
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
name.
</li>
</ul>
If the graph contains a cycle,
any elements where the value of 'flow-from'
computes to an
<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
participating in the cycle
do not become ''CSS Regions''.
<div class="note"><span class="note-prefix">Note </span>
For example, styling like this:
<pre>
#id {
flow-into: foolish;
flow-from: foolish;
}
</pre>
would move the <code>#id</code> element to a "foolish" ''named flow'',
and try to make the <code>#id</code> element
a ''CSS Region'' for the "foolish" ''named flow''.
The "foolish" ''named flow'' would then contain its own region,
creating a cycle.
So the <code>#id</code> element does not become a ''CSS Region''.
</div>
<h4 id="fragmenting-regions">
Nested fragmentation contexts</h4>
A ''CSS Region'' that contains
a fragment of a ''named flow''
can itself be fragmented if it is nested
within a fragmentation context [[!CSS3-BREAK]],
such as when a layout
using a region chain is printed.
In these cases break opportunities
in the named flow fragment
contained by the ''CSS Region''
are determined using the standard
<a href="http://www.w3.org/TR/css3-break/">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 ''CSS Region'',
if that is desired.
A ''CSS Region'' 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">
Region flow break properties: 'break-before', 'break-after', 'break-inside'</h3>
<div class="note"><span class="note-prefix">Note </span>
This section is also defined in [[!CSS3-BREAK]].
If that specification moves to last call
with the region values,
the section here can be replaced by a reference.
</div>
User agents laying out content in mul EC85 tiple regions
must determine where content breaks occur.
The problem of breaking content into fragments fitting in regions
is similar to breaking content into pages or columns.
Each break ends layout in the current region
and causes remaining pieces of content
from the ''named flow'' to be visually formatted
in the following region in the region chain,
if there is one.
The following extends
the 'break-before', 'break-after' and 'break-inside' properties
from the [[!CSS3COL]] specification to account for regions.
The additional values are described below.
<pre class='propdef'>
Name: break-before
Value: auto | always | avoid | left | right | page | column | region | avoid-page | avoid-column | avoid-region
Initial: auto
Applies To: block-level elements
Inherited: no
Computed Value: as specified
Media: visual
</pre>
<pre class='propdef'>
Name: break-after
Value: auto | always | avoid | left | right | page | column | region | avoid-page | avoid-column | avoid-region
Initial: auto
Applies To: block-level elements
Inherited: no
Computed Value: as specified
Media: visual
</pre>
<pre class='propdef'>
Name: break-inside
Value: auto | avoid | avoid-page | avoid-column | avoid-region
Initial: auto
Applies To: block-level elements
Inherited: no
Computed Value: as specified
Media: visual
</pre>
These properties describe page, column and region break behavior
before/after/inside the generated box. These values are normatively defined
in [[!CSS3COL]]:
This specification adds the following new values:
<dl>
<dt>region</dt>
<dd>Always force a region break before (after) the generated box.</dd>
<dt>avoid-region</dt>
<dd>Avoid a region break before (after, inside) the generated box.</dd>
</dl>
The behavior of region breaks with regards to regions
is identical to the behavior of page breaks with regards to pages,
as defined in the [[!CSS21]].
<h3 id="the-region-fragment-property">
The region-fragment property</h3>
<pre class='propdef'>
Name: region-fragment
Value: auto | break
Initial: auto
Applies To: ''CSS Regions''
Inherited: no
Computed Value: as specified
Media: visual
</pre>
The 'region-fragment' property controls the behavior
of the <em id="last-region">last region</em>
associated with a ''named flow''.
<dl>
<dt>auto</dt>
<dd>
Content flows as it would in a regular content box.
If the content exceeds the container box,
it is subject to the
<a href= "http://www.w3.org/TR/CSS21/visufx.html#propdef-overflow">overflow</a>
property's computed value on the ''CSS Region''.
Region breaks must be ignored on the last region.
</dd>
<dt>break</dt>
<dd>
If the content fits within the ''CSS Region'',
then this property has no effect.
If the content does not fit within the ''CSS Region'',
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 last region is not rendered.
</dd>
</dl>
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">
<pre>
&lt;style&gt;
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;/style&gt;
&lt;body&gt;
&lt;article&gt;...&lt;/article&gt;
&lt;div id="region-1"&gt;&lt;/div&gt;
&lt;div id="region-2"&gt;&lt;/div&gt;
&lt;/body&gt;
</pre>
</div>
<figure>
<table style="border: 1px solid gray;width: 100%;" summary=
"Different values for the region-fragment property - Illustration.">
<tr>
<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>
</tr>
<tr>
<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>
</tr>
<tr>
<td><code>region-fragment: break<br>
overflow: hidden</code></td>
<td><code>region-fragment: auto<br>
overflow: hidden</code></td>
</tr>
<tr>
<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>
</tr>
</table>
<figcaption>
Combinations of region-fragment and overflow.
</figcaption>
</figure>
<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