8000 csswg-drafts/css-overflow-4/Overview.bs at e981e620e52ebf2aec25c6d7eea271262ada8a87 · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
1130 lines (987 loc) · 38.1 KB

File metadata and controls

1130 lines (987 loc) · 38.1 KB
<h1>CSS Overflow Module Level 4</h1>
<pre class="metadata">
Status: ED
Work Status: Exploring
ED: https://drafts.csswg.org/css-overflow-4/
Shortname: css-overflow
Group: csswg
Level: 4
TR: https://www.w3.org/TR/css-overflow-4/
Previous version: https://www.w3.org/TR/css-overflow-3/
Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://dbaron.org/, w3cid 15393
Editor: Florian Rivoal, On behalf of Bloomberg, http://florian.rivoal.net/
Abstract: This module contains the features of CSS relating to new mechanisms of overflow handling in visual media (e.g., screen or paper). In interactive media, it describes features that allow the overflow from a fixed size container to be handled by pagination (displaying one page at a time). It also describes features, applying to all visual media, that allow the contents of an element to be spread across multiple fragments, allowing the contents to flow across multiple regions or to have different styles for different fragments.
Ignored Terms: scroll
</pre>
<pre class="link-defaults">
type: dfn; spec:css-multicol-1; text:overflow column
spec:css-pseudo-4; type:selector; text:::first-letter
spec:css-pseudo-4; type:selector; text:::first-line
</pre>
<pre class="anchors">
url: https://drafts.csswg.org/selectors-3/#subject; type: dfn; text: subject;
</pre>
<style>
table.source-demo-pair {
width: 100%;
}
.in-cards-demo {
width: 13em;
height: 8em;
padding: 4px;
border: medium solid blue;
margin: 6px;
font: medium/1.3 Times New Roman, Times, serif;
white-space: nowrap;
}
.bouncy-columns-demo {
width: 6em;
height: 10em;
float: left;
margin: 1em;
font: medium/1.25 Times New Roman, Times, serif;
white-space: nowrap;
}
.bouncy-columns-demo.one {
background: aqua; color: black;
transform: rotate(-3deg);
}
.bouncy-columns-demo.two {
background: yellow; color: black;
transform: rotate(3deg);
}
.article-font-inherit-demo {
font: 1em/1.25 Times New Roman, Times, serif;
white-space: nowrap;
}
.article-font-inherit-demo.one {
width: 12em;
font-size: 1.5em;
margin-bottom: 1em;
height: 4em;
}
.article-font-inherit-demo.two {
width: 11em;
margin-left: 5em;
margin-right: 2em;
}
.dark-columns-demo {
width: 6em;
height: 10em;
float: left;
margin-right: 1em;
font: medium/1.25 Times New Roman, Times, serif;
white-space: nowrap;
}
.dark-columns-demo.one {
background: aqua; color: black;
}
.dark-columns-demo.one :link {
color: blue;
}
.dark-columns-demo.one :visited {
color: purple;
}
.dark-columns-demo.two {
background: navy; color: white;
}
.dark-columns-demo.two :link {
color: aqua;
}
.dark-columns-demo.two :visited {
color: fuchsia;
}
.article-max-lines-demo {
font: 1em/1.25 Times New Roman, Times, serif;
white-space: nowrap;
}
.article-max-lines-demo.one::first-letter {
font-size: 2em;
line-height: 0.9;
}
.article-max-lines-demo.one {
font-size: 1.5em;
width: 16em;
}
.article-max-lines-demo.two {
width: 11.5em;
float: left; margin-right: 1em;
}
.article-max-lines-demo.three {
width: 11.5em;
float: left;
}
</style>
<h2 id="intro">
Introduction</h2>
Note: At the time of writing, [[CSS-OVERFLOW-3]] is not completely finalized yet.
To avoid accidental divergences and maintenance overhead,
This specification is written as a delta specification over css-overflow Level 3.
Once the level 3 specification is final,
its content will be integrated into this specification,
which will then replace it.
Until then, this specification only contains additions and extensions to level 3.
<p>
In CSS Level 1 [[CSS1]], placing more content than would fit
inside an element with a specified size
was generally an authoring error.
Doing so caused the content to extend
outside the bounds of the element,
which would likely cause
that content to overlap with other elements.
</p>
<p>
CSS Level 2 [[CSS21]] introduced the 'overflow' property,
which allows authors to have overflow be handled by scrolling,
which means it is no longer an authoring error.
It also allows authors to specify
that overflow is handled by clipping,
which makes sense when the author's intent
is that the content not be shown.
This was further refined in the CSS Overflow Module Level 3 [[CSS-OVERFLOW-3]].
</p>
<p>
However, scrolling is not the only way
to present large amounts of content,
and may even not be the optimal way.
After all, the codex replaced the scroll
as the common format for large written works
because of its advantages.
</p>
<p>
This specification introduces
a mechanism for Web pages to specify
that an element of a page should handle overflow
through pagination rather than through scrolling.
</p>
<p>
This specification also extends the concept of overflow
in another direction.
Instead of requiring that authors specify a single area
into which the content of an element must flow,
this specification allows authors to specify multiple fragments,
each with their own dimensions and styles,
so that the content of the element can flow from one to the next,
using as many as needed to place the content without overflowing.
</p>
<p>
In both of these cases, implementations must
break the content in the block-progression dimension.
Implementations must do this is described
in the CSS Fragmentation Module [[!CSS3-BREAK]].
</p>
<h2 id="overflow-concepts">Types of overflow</h2>
Issue: copy level 3 content when final
<h2 id="overflow-properties">Overflow properties</h2>
Issue: copy level 3 content when final
<h2 id="scollbar-gutter-property">
Reserving space for the scrollbar: the 'scrollbar-gutter' property</h2>
The space between the inner border edge and the outer padding edge
which user agents may reserve to display the scrollbar
is called the <dfn>scrollbar gutter</dfn>.
The 'scrollbar-gutter' property gives control to the author
over the presence of <a>scrollbar gutters</a>
separately from the ability to control the presence of scrollbars
provided by the 'overflow' property.
<pre class="propdef">
Name: scrollbar-gutter
Value: ''auto'' | [ ''stable'' | ''always'' ] && ''both''? && ''force''?
Initial: auto
Inherited: yes
Computed value: specified value
</pre>
This property affects the presence of <a>scrollbar gutters</a>
placed at the <a>inline start</a> edge or <a>inline end</a> edge of the box.
The presence of a <a>scrollbar gutter</a>
at the <a>block start</a> edge and <a>block end</a> edge of the box
cannot be controlled in this level,
and is determined the same way as the presence of <a>scrollbar gutters</a>
placed at the <a>inline start</a> edge or <a>inline end</a> edge of the box
when 'scrollbar-gutter' is ''scrollbar-gutter/auto''.
Scrollbars which by default are placed over the content box
and do not cause <a>scrollbar gutters</a> to be created
are called <dfn>overlay scrollbars</dfn>.
Such scrollbars are usually partially transparent, revealing the content behind them if any.
Their appearance and size may vary
based on whether and how the user is interacting with them.
Scrollbars which are always placed in a <a>scrollbar gutter</a>,
consuming space when present,
are called <dfn>classic scrollbars</dfn>.
Such scrollbars are usually opaque.
Whether <a>classic scrollbars</a> or <a>overlay scrollbars</a> are used is UA defined.
The appearance and size of the scrollbar is UA defined.
Whether scrollbars appear on the start or end edge of the box is UA defined.
For <a>classic scrollbars</a>,
the width of the <a>scrollbar gutter</a> is the same as the width of the scrollbar.
For <a>overlay scrollbars</a>,
the width of the <a>scrollbar gutter</a> is UA defined.
However, it must not be 0,
and it must not change based on user interactions with the page or the scrollbar
even if the scrollbar itself changes.
Also, it must be the same for all elements in the page.
The values of this property have the following meaning:
<dl dfn-for="scrollbar-gutter">
<dt><dfn>''scrollbar-gutter/auto''</dfn>
<dd><a>Classic scrollbars</a> consume space by creating a <a>scrollbar gutter</a>
when 'overflow' is ''overflow/scroll',
or when 'overflow' is ''overflow/auto'' and the box is overflowing.
<a>Overlay scrollbars</a> do not consume space.
<dt><dfn>''stable''</dfn>
<dd>The <a>scrollbar gutter</a> is present when
'overflow' is ''overflow/scroll'' or ''overflow/auto''
and the scrollbar is a <a>classic scrollbar</a>
even if the box is not overflowing,
but not when the scrollbar is an <a>overlay scrollbar</a>.
<dt><dfn>''always''</dfn>
<dd>The <a>scrollbar gutter</a> is always present when
'overflow' is ''overflow/scroll'' or ''overflow/auto'',
regardless of the type of scrollbar or
of whether the box is overflowing.
<dt><dfn>''both''</dfn>
<dd>If a <a>scrollbar gutter</a> would be present
on one of the inline start edge or the inline end edge of the box,
another <a>scrollbar gutter</a> must be present on the opposite edge as well.
<dt><dfn>''force''</dfn>
<dd>When the ''scrollbar-gutter/force'' keyword is present
''scrollbar-gutter/stable'' and ''scrollbar-gutter/always'' take effect
when 'overflow' is ''overflow/visible'', ''overflow/hidden'' or ''overflow/clip''
in addition ''overflow/auto'' or ''overflow/scroll''.
This does not cause a scrollbar to be displayed, only a <a>scrollbar gutter</a>.
</dl>
When the <a>scrollbar gutter</a> is present but the scrollbar is not,
or the scrollbar is transparent or otherwise does not fully obscure the <a>scrollbar gutter</a>,
the background of the <a>scrollbar gutter</a> must be painted as an extension of the padding.
<div class=note>
Note: The following table summarizes the interaction of 'overflow' and 'scrollbar-gutter',
showing in which case space is reserved for the <a>scrollbar gutter</a>.
In this table, “G” represents cases where space is reserved for the <a>scrollbar gutter</a>,
“f?” cases where space is reserved for the <a>scrollbar gutter</a>
if ''scrollbar-gutter/force'' was specified,
and empty cells cases where the no space is reserved.
<table class=data>
<thead>
<tr>
<td>
<td>
<th colspan=2>Classic scrollbars
<th colspan=2>Overlay scrollbars
<tr>
<th>'overflow'
<th>'scrollbar-gutter'
<th>Overflowing
<th>Not overflowing
<th>Overflowing
<th>Not overflowing
</thead>
<tr>
<th rowspan=3>'overflow/scroll'
<th>''scrollbar-gutter/auto''
<td>G
<td>G
<td>
<td>
<tr>
<th>''scrollbar-gutter/stable''
<td>G
<td>G
<td>
<td>
<tr>
<th>''scrollbar-gutter/always''
<td>G
<td>G
<td>G
<td>G
<tr>
<th rowspan=3>''overflow/auto''
<th>''scrollbar-gutter/auto''
<td>G
<td>
<td>
<td>
<tr>
<th>''scrollbar-gutter/stable''
<td>G
<td>G
<td>
<td>
<tr>
<th>''scrollbar-gutter/always''
<td>G
<td>G
<td>G
<td>G
<tr>
<th rowspan=3>''overflow/visible'', ''overflow/hidden'', ''overflow/clip''
<th>''scrollbar-gutter/auto''
<td>
<td>
<td>
<td>
<tr>
<th>''scrollbar-gutter/stable''
<td>f?
<td>f?
<td>
<td>
<tr>
<th>''scrollbar-gutter/always''
<td>f?
<td>f?
<td>f?
<td>f?
</table>
</div>
<h2 id="fragmentation">Fragmentation of overflow</h2>
The 'continue' property gives authors the ability
to request that content that does not fit inside an element
be fragmented (in the sense of [[!CSS3-BREAK]]),
and provides alternatives
for where the remaining content should continue.
Notably, this property explains traditional pagination,
and extends it further.
<pre class=propdef>
Name: continue
Value: ''auto'' | ''overflow'' | ''paginate'' | ''fragments'' | ''discard''
Initial: auto
Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
Inherited: no
Percentages: N/A
Media: visual
Computed value: see below
Animatable: no
Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
</pre>
Issue: The naming of this property and its values is preliminary.
This was initially proposed as
"fragmentation: auto | none | break | clone | page"
in <a href="https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html">https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html</a>,
and there is not yet wide agreement as to which naming is better.
Issue: This property is meant to generalize and replace 'region-fragment'.
Once it is sufficiently stable in this specification,
'region-fragment' should be removed from the regions specification in favor of this.
Note: ''continue: fragments'' replaces "overflow:fragments"
from earlier versions of this specification,
while ''continue: paginate'' replaces "overflow: paged-x | paged-y | paged-x-controls | paged-y-controls"
<dl dfn-for="continue" dfn-type="value">
<dt><dfn>auto</dfn>
<dd>''continue/auto'' may only occur as a computed value
if the element is a <a spec="css-regions">CSS Region</a>
other than the last one in a <a spec="css-regions">region chain</a>.
Content that doesn't fit is pushed to the next region of the chain.
In all other cases, ''continue/auto'' computes to one of the other values.
<dt><dfn>overflow</dfn>
<dd>Content that doesn't fit overflows, according to the 'overflow' property
<dt><dfn>discard</dfn>
<dd>Content that doesn't fit is discarded at a fragmentation break
Note: generalized from region-fragment: break; on the last region of a region chain
Issue: When the element isn't a <a spec="css-break">fragmentation container</a> already,
should this work by turning it directly into one,
or by creating a <a>fragment box</a> inside it like ''continue/fragments'' does?
<dt><dfn>paginate</dfn>
<dd>Content that doesn't fit paginates.
This creates a paginated view inside the element
similar to the way that 'overflow: scroll' creates a scrollable view.
See <a href="#paginated-overflow">paginated overflow</a>
Note: Print is effectively "continue: paginate" on the root.
<dt><dfn>fragments</dfn>
<dd>content that doesn't fit causes the element to copy itself and continue laying out.
See <a href="#fragment-overflow">fragment overflow</a>.
</dl>
The computed value of the 'continue' for a given element or pseudo element is determined as follow:
<ol>
<li>On elements or pseudo elements with <a>layout containment</a> (see [[!CSS-CONTAIN-1]]),
if the specified value is ''continue/auto'' or ''continue/fragments''
then the computed value is ''continue/overflow' 5550 ;'.
<li>Otherwise, if the specified value is ''continue/auto''
<ol>
<li>On a <a spec="css-regions">CSS Region</a> other than the last one in a <a spec="css-regions">region chain</a>,
the computed value is ''continue/auto''
<li>On a page
the computed value is ''continue/paginate''
<li>On a <a>fragment box</a>
the computed value is ''continue/fragments''
<li>Otherwise, the computed value is ''continue/overflow''
</ol>
<li>Otherwise, if the specified value is ''continue/fragments''
<ol>
<li>On a page
the computed value is ''continue/paginate''
<li>Otherwise, the computed value is the specified value
</ol>
<li>In all other cases, the computed value is the specified value
</ol>
Issue: If we introduce a pseudo element that can select columns in a multicol,
we would need to specify that auto computes to auto on it,
or introduce a new value and have auto compute to that
(but what would that value compute to on things that aren't columns?).
Note: For background discussions leading to this property, see these threads:
<a href="http://lists.w3.org/Archives/Public/www-style/2012May/1197.html">discussion of overflow, overflow-x, overflow-y and overflow-style</a> and
<a href="https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html">proposal for a fragmentation property</a>
<h2 id="paginated-overflow">Paginated overflow</h2>
This section introduces and defines the meaning of the ''continue/paginate'' value of the 'continue' property.
Issue: Write this section
Issue: Pages should be possible to style with @page rules. How does that work for nested pages?
<div class="issue">
Should traditional pagination (e.g. when printing)
be expressed through some magic in the computed value of ''continue/auto'',
or by inserting this in the UA stylesheet:
<pre><code class="lang-css">
@media (overflow-block: paged), (overflow-block: optional-paged) {
:root {
continue: paginate;
}
}
</code></pre>
</div>
Issue: Traditional pagination (e.g. when printing) assumes that
:root is contained in the page box,
rather than having the page box be a pseudo element child of :root.
Can we work around that using something similar to fragment boxes?
Or maybe by having a fragment box (reproducing :root) inside a page box inside :root?
Issue: How does the page box model work when it is a child of a regular css box?
Issue: The initial proposal in [[CSS3GCPM]] and implementation from Opera
used 4 values instead of ''continue/paginate'':
"paged-x | paged-y | paged-x-controls | paged-y-controls".
Should this property also include these values,
or are they better handled as separate properties?
(e.g.: "pagination-layout: auto | horizontal | vertical", "pagination-controls: auto | none")
Issue: Ability to display N pages at once
rather than just one page at once?
Could this be a value of "pagination-layout", such as:
"pagination-layout: horizontal 2;"
Issue: Brad Kemper has proposed a model for combining pagination and
fragment overflow, which also deals with displaying multiple pages.
<a href="http://www.w3.org/mid/FF1704C5-D5C1-4D6F-A99D-0DD094036685@gmail.com">http://www.w3.org/mid/FF1704C5-D5C1-4D6F-A99D-0DD094036685@gmail.com</a>
<p class="issue">
The current implementation of paginated overflow uses
the overflow/overflow-x/overflow-y properties
rather than the overflow-style property as proposed
in the [[CSS3GCPM]] draft
(which also matches the [[CSS3-MARQUEE]] proposal).
or the 'continue' property as describ B670 ed here.
</p>
<h2 id="fragment-overflow">Fragment overflow</h2>
This section introduces and defines the meaning of
the ''continue/fragments'' value of the 'continue' property.
<p>
When the computed value of 'continue' for an element is ''continue/fragments'',
and implementations would otherwise have created a box for the element,
then implementations must create a sequence of <dfn>fragment box</dfn>es
for that element.
(It is possible for an element with ''continue: fragments''
to generate only one <a>fragment box</a>.
However, if an element's computed 'continue' is not ''continue/fragments'',
then its box is not a <a>fragment box</a>.)
Every <a>fragment box</a> is a fragmentation container,
and any overflow
that would cause that fragmentation container to fragment
causes another <a>fragment box</a> created as a next sibling
of the previous one.
<span class="issue">Or is it as though it's a next sibling of
the element? Need to figure out exactly how this interacts with
other box-level fixup.</span>
Additionally, if the <a>fragment box</a> is also
a multi-column box (as defined in [[!CSS3COL]]
<span class="issue">though it defines <i>multi-column element</i></span>)
any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
instead is flown into an additional fragment box.
However, fragment boxes may themselves be broken
(due to fragmentation in a fragmentation context outside of them,
such as pages, columns, or other fragment boxes);
such breaking leads to fragments of the same fragment box
rather than multiple fragment boxes.
(This matters because fragment boxes may be styled by their index;
such breaking leads to multiple fragments of a fragment box
with a single index.
This design choice is so that
breaking a fragment box across pages does not break
the association of indices to particular pieces of content.)
<span class="issue">Should a forced break that breaks to
an outer fragmentation context cause a new fragment of a single
fragment box or a new fragment box?</span>
<span class="issue">Should we find a term other than
<a>fragment box</a> here to make this a little less confusing?</span>
</p>
<p class="issue">
What if we want to be able to style the pieces of an element
split within another type of fragmentation context?
These rules prevent ever using ''::nth-fragment()'' for that,
despite that the name seems the most logical name for such a feature.
</p>
<div class="example">
<table class="source-demo-pair"><tr><td>
<pre><code highlight="html">&lt;!DOCTYPE HTML&gt;
&lt;title&gt;Breaking content into
equal-sized cards&lt;/title&gt;
&lt;style&gt;
.in-cards {
continue: fragments;
width: 13em;
height: 8em;
padding: 4px;
border: medium solid blue;
margin: 6px;
font: medium/1.3 Times New
Roman, Times, serif;
}
&lt;/style&gt;
&lt;div class="in-cards"&gt;
In this example, the text in the div
is broken into a series of cards.
These cards all have the same style.
The presence of enough content to
overflow one of the cards causes
another one to be created. The second
card is created just like it's the
next sibling of the first.
&lt;/div&gt;</code></pre></td><td>
<div class="in-cards-demo">In this example, the text in the<br>div is broken into a series of<br>cards. These cards all have the<br>same style. The presence of<br>enough content to overflow<br>one of the cards causes another</div>
<div class="in-cards-demo">one to be created. The second<br>card is created just like it's the<br>next sibling of the first.</div>
</td></tr></table>
</div>
<p class="issue">
We should specify that ''continue: fragments'' does not apply
to at least some table parts,
and perhaps other elements as well.
We need to determine exactly which ones.
</p>
<p class="issue">
This specification needs to say which type of
fragmentation context is created
so that it's clear which values of the 'break-*' properties
cause breaks within this context.
We probably want ''break-*: region'' to apply.
</p>
<p class="issue">
This specification needs a processing model
that will apply in cases where the layout containing the
fragments has characteristics that use the intrinsic size of the fragments
to change the amount of space available for them,
such as [[CSS3-GRID-LAYOUT]].
There has already been some work on such a processing model
in [[CSS3-REGIONS]],
and the work done on a model there,
and the editors of that specification,
should inform what happens in this specification.
</p>
<h3 id="fragment-styling">Fragment styling</h3>
<h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
<p>
The <dfn selector>::nth-fragment()</dfn> pseudo-element
is a pseudo-element
that describes some of the <a>fragment box</a>es generated by an element.
The argument to the pseudo-element takes the same syntax
as the argument to the :nth-child() pseudo-class
defined in [[!SELECT]], and has the same meaning
except that the number is relative to
<a>fragment box</a>es generated by the element
instead of siblings of the element.
</p>
<p class="note">
Selectors that allow addressing fragments
by counting from the end rather than the start
are intentionally not provided.
Such selectors would interfere with determining
the number of fragments.
</p>
<p class="issue">
Depending on future discussions,
this ''::nth-fragment(<var>an+b</var>)'' syntax
may be replaced with
the new ''::fragment:nth(<var>an+b</var>)'' syntax.
</p>
<h4 id="style-of-fragments">Styling of fragments</h4>
<p class="issue">
Should this apply to continue:fragments only,
or also to continue:paginate?
(If it applies,
then stricter property restrictions would be needed
for continue:paginate.)
</p>
<p>
In the absence of rules with ''::nth-fragment()'' pseudo-elements,
the computed style for each <a>fragment box</a>
is the computed style for the element
for which the <a>fragment box</a> was created.
However, the style for a <a>fragment box</a> is also influenced
by rules whose selector's <a>subject</a> [[!SELECT]]
has an ''::nth-fragment()'' pseudo-element,
if the 1-based number of the <a>fragment box</a> matches
that ''::nth-fragment()'' pseudo-element
and the selector (excluding the ''::nth-fragment()'' pseudo-element)
matches the element generating the fragments.
</p>
<p>
When determining the style of the <a>fragment box</a>,
these rules that match the fr 5550 agment pseudo-element
cascade together with the rules that match the element,
with the fragment pseudo-element adding the specificity
of a pseudo-class to the specificity calculation.
<span class="issue">Does this need to be specified in
the cascading module as well?</span>
</p>
<div class="example">
<table class="source-demo-pair"><tr><td>
<pre><code highlight="html">&lt;!DOCTYPE HTML&gt;
&lt;style&gt;
.bouncy-columns {
continue: fragments;
width: 6em;
height: 10em;
float: left;
margin: 1em;
font: medium/1.25 Times New
Roman, Times, serif;
}
.bouncy-columns::nth-fragment(1) {
background: aqua; color: black;
transform: rotate(-3deg);
}
.bouncy-columns::nth-fragment(2) {
background: yellow; color: black;
transform: rotate(3deg);
}
&lt;/style&gt;
&lt;div class="bouncy-columns"&gt;
<i>...</i>
&lt;/div&gt;</code></pre></td><td>
<div class="bouncy-columns-demo one">In this<br>example, the<br>text in the div<br>is broken into<br>a series of<br>columns. The<br>author<br>probably</div>
<div class="bouncy-columns-demo two">intended the<br>text to fill two<br>columns. But<br>if it happens to<br>fill three<br>columns, the<br>third column is<br>still created. It</div>
<div class="bouncy-columns-demo">just doesn't<br>have any<br>fragment-specific<br>styling because<br>the author<br>didn't give it<br>any.</div>
</td></tr></table>
</div>
<p>
Styling an ''::nth-fragment()'' pseudo-element with the 'continue'
property does take effect;
if a <a>fragment box</a> has a
computed value of 'continue' other than ''fragments''
then that fragment box is the last fragment.
However, overriding 'continue' on the first fragment
does not cause the <a>fragment box</a> not to exist;
whether there are fragment boxes at all is determined by
the computed value of overflow for the element.
</p>
<p>
Styling an ''::nth-fragment()'' pseudo-element with the 'content'
property has no effect;
the computed value of 'content' for the fragment box
remains the same as the computed value of content for the element.
</p>
<p>
Specifying ''display: none'' for a <a>fragment box</a> causes
the fragment box with that index not to be generated.
However, in terms of the indices
used for matching ''::nth-fragment()'' pseudo-elements
of later fragment boxes,
it still counts as though it was generated.
However, since it is not generated, it does not contain any content.
</p>
<p>
Specifying other values of 'display', 'position',
or 'float' is permitted, but is not allowed to change
the <a>inner display type</a>.
(Since 'continue' only
applies to block containers, flex containers, and grid containers).
<span class="issue">Need to specify exactly how this works</span>
</p>
<p>
To match the model for other pseudo-elements
where the pseudo-elements live inside their corresponding element,
declarations in ''::nth-fragment()'' pseudo-elements override
declarations in rules without the pseudo-element.
The relative priority within such declarations is determined
by normal cascading order (see [[!CSS21]]).
</p>
<p>
Styles specified on ''::nth-fragment()'' pseudo-elements
do affect inheritance to content within the <a>fragment box</a>.
In other words, the content within the <a>fragment box</a> must
inherit from the fragment box's style (i.e., the pseudo-element style)
rather than directly from the element.
This means that elements split between fragment boxes may
have different styles for different parts of the element.
</p>
<p class="issue">
This inheritance rule allows specifying styles indirectly
(by using explicit ''inherit'' or using default inheritance
on properties that don't apply to ''::first-letter'')
that can't be specified directly
(based on the rules in the next section).
This is a problem.
The restrictions that apply to styling inside fragments
should also apply to inheritance from fragments.
</p>
<div class="example">
<table class="source-demo-pair"><tr><td>
<pre><code highlight="html">&lt;!DOCTYPE HTML&gt;
&lt;style&gt;
.article {
continue: fragments;
}
.article::nth-fragment(1) {
font-size: 1.5em;
margin-bottom: 1em;
height: 4em;
}
.article::nth-fragment(2) {
margin-left: 5em;
margin-right: 2em;
}
&lt;/style&gt;
&lt;div class="article"&gt;
The &lt;code&gt;font-size&lt;/code&gt; property<i>...</i>
&lt;/div&gt;</code></pre></td><td>
<div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
<div class="article-font-inherit-demo two">descendants of the fragment.<br>This means that inherited<br>properties can be used<br>reliably on a fragment, as in<br>this example.</div>
</td></tr></table>
</div>
<h4 id="style-in-fragments">Styling inside fragments</h4>
<p class="issue">
Should this apply to continue:fragments only,
or also to continue:paginate?
</p>
<p>
The ''::nth-fragment()'' pseudo-element
can also be used to style
content inside of a <a>fragment box</a>.
Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
the ''::nth-fragment()'' pseudo-element can be applied
to parts of the selector other than the subject:
in particular, it can match ancestors of the subject.
However, the only CSS properties applied
by rules with such selectors
are those that apply
to the ''::first-letter'' pseudo-element.
</p>
<p>
To be more precise,
when a rule's selector has ''::nth-fragment()'' pseudo-elements
attached to parts of the selector other than the subject,
the declarations in that rule apply to
a fragment (or pseudo-element thereof) when:
</p>
<ol>
<li>
the declarations are for properties that apply to the
''::first-letter'' pseudo-element,
</li>
<li>
the declarations would apply to
that fragment (or pseudo-element thereof)
had those ''::nth-fragment()'' pseudo-elements been removed,
with a particular association between
each sequence of simple selectors and the element it matched,
and
</li>
<li>
for each removed ''::nth-fragment()'' pseudo-element,
the fragment lives within a <a>fragment box</a>
of the element associated in that association
with the selector that the pseudo-element was attached to,
and whose index matches the pseudo-element.
</li>
</ol>
<div class="example">
<table class="source-demo-pair"><tr><td>
<pre><code highlight="html">&lt;!DOCTYPE HTML&gt;
&lt;style&gt;
.dark-columns {
continue: fragments;
width: 6em;
height: 10em;
float: left;
margin-right: 1em;
font: medium/1.25 Times New
Roman, Times, serif;
}
.dark-columns::nth-fragment(1) {
background: aqua; color: black;
}
.dark-columns::nth-fragment(1) :link {
color: blue;
}
.dark-columns::nth-fragment(1) :visited {
color: purple;
}
.dark-columns::nth-fragment(2) {
background: navy; color: white;
}
.dark-columns::nth-fragment(2) :link {
color: aqua;
}
.dark-columns::nth-fragment(2) :visited {
color: fuchsia;
}
&lt;/style&gt;
&lt;div class="dark-columns"&gt;
<i>...</i>
&lt;/div&gt;</code></pre></td><td>
<div class="dark-columns-demo one">In this<br><a href="http://en.wiktionary.org/wiki/example">example</a>, the<br>text flows<br>from one<br>light-colored<br>fragment into<br>another<br>dark-colored</div>
<div class="dark-columns-demo two">fragment. We<br>therefore want<br>different styles<br>for <a href="http://www.w3.org/Provider/Style/IntoContext.html">hyperlinks</a><br>in the different<br>fragments.</div>
</td></tr></table>
</div>
<h3 id="max-lines">The 'max-lines' property</h3>
<p>
Authors may wish to style the opening lines of an element
with different styles
by putting those opening lines in a separate fragment.
However, since it may be difficult to predict the exact height
occupied by those lines
in order to restrict the first fragment to that height,
this specification introduces a 'max-lines' property
that forces a fragment to break
after a specified number of lines.
This forces a break after the given number of lines
contained within the element or its descendants,
as long as those lines are in the same block formatting context.
</p>
<pre class=propdef>
Name: max-lines
Value: none | <<integer>>
Initial: none
Applies to: fragment boxes
Inherited: no
Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
Percentages: N/A
Media: visual
Computed value: specified value
Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
</pre>
<dl dfn-for="max-lines" dfn-type="value">
<dt><dfn>none</dfn>
<dd>
<p>
Breaks occur only as specified elsewhere.
</p>
</dd>
<dt><dfn><<integer>></dfn>
<dd>
<p>
In addition to any breaks specified elsewhere,
a break is forced before any line that would exceed
the given number of lines
being placed inside the element
(excluding lines that are in
a different block formatting context from
the block formatting context to which
an unstyled child of the element would belong).
</p>
<p class="issue">
If there are multiple boundaries between this line
and the previous, where exactly (in terms of element
boundaries) is the break forced?
</p>
<p>
Only positive integers are accepted.
Zero or negative integers are a parse error.
</p>
</dd>
</dl>
<p class="issue">Should this apply to fragment overflow only, or also
to pagination?
Given what we're doing with the continue property,
it should actually apply to any fragmentainer.</p>