Tue, 01 Aug 2017 14:42:19 +0200
[css-overflow] Spell check.
1 <h1>CSS Overflow Module Level 4</h1>
2 <pre class="metadata">
3 Status: ED
4 Work Status: Exploring
5 ED: https://drafts.csswg.org/css-overflow-4/
6 Shortname: css-overflow
7 Group: csswg
8 Level: 4
9 TR: https://www.w3.org/TR/css-overflow-4/
10 Previous version: https://www.w3.org/TR/css-overflow-3/
11 Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://dbaron.org/, w3cid 15393
12 Editor: Florian Rivoal, On behalf of Bloomberg, http://florian.rivoal.net/
13 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.
14 Ignored Terms: scroll
15 </pre>
16 <pre class="link-defaults">
17 type: dfn; spec:css-multicol-1; text:overflow column
18 spec:css-pseudo-4; type:selector; text:::first-letter
19 spec:css-pseudo-4; type:selector; text:::first-line
20 </pre>
21 <pre class="anchors">
22 url: https://drafts.csswg.org/selectors-3/#subject; type: dfn; text: subject;
23 </pre>
24 <style>
25 table.source-demo-pair {
26 width: 100%;
27 }
29 .in-cards-demo {
30 width: 13em;
31 height: 8em;
33 padding: 4px;
34 border: medium solid blue;
35 margin: 6px;
37 font: medium/1.3 Times New Roman, Times, serif;
38 white-space: nowrap;
39 }
41 .bouncy-columns-demo {
42 width: 6em;
43 height: 10em;
44 float: left;
45 margin: 1em;
46 font: medium/1.25 Times New Roman, Times, serif;
47 white-space: nowrap;
48 }
49 .bouncy-columns-demo.one {
50 background: aqua; color: black;
51 transform: rotate(-3deg);
52 }
53 .bouncy-columns-demo.two {
54 background: yellow; color: black;
55 transform: rotate(3deg);
56 }
58 .article-font-inherit-demo {
59 font: 1em/1.25 Times New Roman, Times, serif;
60 white-space: nowrap;
61 }
62 .article-font-inherit-demo.one {
63 width: 12em;
64 font-size: 1.5em;
65 margin-bottom: 1em;
66 height: 4em;
67 }
68 .article-font-inherit-demo.two {
69 width: 11em;
70 margin-left: 5em;
71 margin-right: 2em;
72 }
74 .dark-columns-demo {
75 width: 6em;
76 height: 10em;
77 float: left;
78 margin-right: 1em;
79 font: medium/1.25 Times New Roman, Times, serif;
80 white-space: nowrap;
81 }
82 .dark-columns-demo.one {
83 background: aqua; color: black;
84 }
85 .dark-columns-demo.one :link {
86 color: blue;
87 }
88 .dark-columns-demo.one :visited {
89 color: purple;
90 }
91 .dark-columns-demo.two {
92 background: navy; color: white;
93 }
94 .dark-columns-demo.two :link {
95 color: aqua;
96 }
97 .dark-columns-demo.two :visited {
98 color: fuchsia;
99 }
101 .article-max-lines-demo {
102 font: 1em/1.25 Times New Roman, Times, serif;
103 white-space: nowrap;
104 }
105 .article-max-lines-demo.one::first-letter {
106 font-size: 2em;
107 line-height: 0.9;
108 }
109 .article-max-lines-demo.one {
110 font-size: 1.5em;
111 width: 16em;
112 }
113 .article-max-lines-demo.two {
114 width: 11.5em;
115 float: left; margin-right: 1em;
116 }
117 .article-max-lines-demo.three {
118 width: 11.5em;
119 float: left;
120 }
121 </style>
123 <h2 id="intro">
124 Introduction</h2>
126 Note: At the time of writing, [[CSS-OVERFLOW-3]] is not completely finalized yet.
127 To avoid accidental divergences and maintenance overhead,
128 This specification is written as a delta specification over css-overflow Level 3.
129 Once the level 3 specification is final,
130 its content will be integrated into this specification,
131 which will then replace it.
132 Until then, this specification only contains additions and extensions to level 3.
134 <p>
135 In CSS Level 1 [[CSS1]], placing more content than would fit
136 inside an element with a specified size
137 was generally an authoring error.
138 Doing so caused the content to extend
139 outside the bounds of the element,
140 which would likely cause
141 that content to overlap with other elements.
142 </p>
144 <p>
145 CSS Level 2 [[CSS21]] introduced the 'overflow' property,
146 which allows authors to have overflow be handled by scrolling,
147 which means it is no longer an authoring error.
148 It also allows authors to specify
149 that overflow is handled by clipping,
150 which makes sense when the author's intent
151 is that the content not be shown.
152 This was further refined in the CSS Overflow Module Level 3 [[CSS-OVERFLOW-3]].
153 </p>
155 <p>
156 However, scrolling is not the only way
157 to present large amounts of content,
158 and may even not be the optimal way.
159 After all, the codex replaced the scroll
160 as the common format for large written works
161 because of its advantages.
162 </p>
164 <p>
165 This specification introduces
166 a mechanism for Web pages to specify
167 that an element of a page should handle overflow
168 through pagination rather than through scrolling.
169 </p>
171 <p>
172 This specification also extends the concept of overflow
173 in another direction.
174 Instead of requiring that authors specify a single area
175 into which the content of an element must flow,
176 this specification allows authors to specify multiple fragments,
177 each with their own dimensions and styles,
178 so that the content of the element can flow from one to the next,
179 using as many as needed to place the content without overflowing.
180 </p>
182 <p>
183 In both of these cases, implementations must
184 break the content in the block-progression dimension.
185 Implementations must do this is described
186 in the CSS Fragmentation Module [[!CSS3-BREAK]].
187 </p>
189 <h2 id="overflow-concepts">Types of overflow</h2>
191 Issue: copy level 3 content when final
194 <h2 id="overflow-properties">Overflow properties</h2>
196 Issue: copy level 3 content when final
199 <h2 id="scollbar-gutter-property">
200 Reserving space for the scrollbar: the 'scrollbar-gutter' property</h2>
202 The space between the inner border edge and the outer padding edge
203 which user agents may reserve to display the scrollbar
204 is called the <dfn>scrollbar gutter</dfn>.
206 The 'scrollbar-gutter' property gives control to the author
207 over the presence of <a>scrollbar gutters</a>
208 separately from the ability to control the presence of scrollbars
209 provided by the 'overflow' property.
211 <pre class="propdef">
212 Name: scrollbar-gutter
213 Value: ''auto'' | [ ''stable'' | ''always'' ] && ''both''? && ''force''?
214 Initial: auto
215 Inherited: yes
216 Computed value: specified value
217 </pre>
219 This property affects the presence of <a>scrollbar gutters</a>
220 placed at the <a>inline start</a> edge or <a>inline end</a> edge of the box.
222 The presence of a <a>scrollbar gutter</a>
223 at the <a>block start</a> edge and <a>block end</a> edge of the box
224 cannot be controlled in this level,
225 and is determined the same way as the presence of <a>scrollbar gutters</a>
226 placed at the <a>inline start</a> edge or <a>inline end</a> edge of the box
227 when 'scrollbar-gutter' is ''scrollbar-gutter/auto''.
229 Scrollbars which by default are placed over the content box
230 and do not cause <a>scrollbar gutters</a> to be created
231 are called <dfn>overlay scrollbars</dfn>.
232 Such scrollbars are usually partially transparent, revealing the content behind them if any.
233 Their appearance and size may vary
234 based on whether and how the user is interacting with them.
236 Scrollbars which are always placed in a <a>scrollbar gutter</a>,
237 consuming space when present,
238 are called <dfn>classic scrollbars</dfn>.
239 Such scrollbars are usually opaque.
241 Whether <a>classic scrollbars</a> or <a>overlay scrollbars</a> are used is UA defined.
243 The appearance and size of the scrollbar is UA defined.
245 Whether scrollbars appear on the start or end edge of the box is UA defined.
247 For <a>classic scrollbars</a>,
248 the width of the <a>scrollbar gutter</a> is the same as the width of the scrollbar.
249 For <a>overlay scrollbars</a>,
250 the width of the <a>scrollbar gutter</a> is UA defined.
251 However, it must not be 0,
252 and it must not change based on user interactions with the page or the scrollbar
253 even if the scrollbar itself changes.
254 Also, it must be the same for all elements in the page.
256 The values of this property have the following meaning:
258 <dl dfn-for="scrollbar-gutter">
259 <dt><dfn>''scrollbar-gutter/auto''</dfn>
260 <dd><a>Classic scrollbars</a> consume space by creating a <a>scrollbar gutter</a>
261 when 'overflow' is ''overflow/scroll',
262 or when 'overflow' is ''overflow/auto'' and the box is overflowing.
263 <a>Overlay scrollbars</a> do not consume space.
265 <dt><dfn>''stable''</dfn>
266 <dd>The <a>scrollbar gutter</a> is present when
267 'overflow' is ''overflow/scroll'' or ''overflow/auto''
268 and the scrollbar is a <a>classic scrollbar</a>
269 even if the box is not overflowing,
270 but not when the scrollbar is an <a>overlay scrollbar</a>.
272 <dt><dfn>''always''</dfn>
273 <dd>The <a>scrollbar gutter</a> is always present when
274 'overflow' is ''overflow/scroll'' or ''overflow/auto'',
275 regardless of the type of scrollbar or
276 of whether the box is overflowing.
278 <dt><dfn>''both''</dfn>
279 <dd>If a <a>scrollbar gutter</a> would be present
280 on one of the inline start edge or the inline end edge of the box,
281 another <a>scrollbar gutter</a> must be present on the opposite edge as well.
283 <dt><dfn>''force''</dfn>
284 <dd>When the ''scrollbar-gutter/force'' keyword is present
285 ''scrollbar-gutter/stable'' and ''scrollbar-gutter/always'' take effect
286 when 'overflow' is ''overflow/visible'', ''overflow/hidden'' or ''overflow/clip''
287 in addition ''overflow/auto'' or ''overflow/scroll''.
288 This does not cause a scrollbar to be displayed, only a <a>scrollbar gutter</a>.
289 </dl>
291 When the <a>scrollbar gutter</a> is present but the scrollbar is not,
292 or the scrollbar is transparent or otherwise does not fully obscure the <a>scrollbar gutter</a>,
293 the background of the <a>scrollbar gutter</a> must be painted as an extension of the padding.
295 <div class=note>
296 Note: The following table summarizes the interaction of 'overflow' and 'scrollbar-gutter',
297 showing in which case space is reserved for the <a>scrollbar gutter</a>.
298 In this table, âGâ represents cases where space is reserved for the <a>scrollbar gutter</a>,
299 âf?â cases where space is reserved for the <a>scrollbar gutter</a>
300 if ''scrollbar-gutter/force'' was specified,
301 and empty cells cases where the no space is reserved.
303 <table class=data>
304 <thead>
305 <tr>
306 <td>
307 <td>
308 <th colspan=2>Classic scrollbars
309 <th colspan=2>Overlay scrollbars
310 <tr>
311 <th>'overflow'
312 <th>'scrollbar-gutter'
313 <th>Overflowing
314 <th>Not overflowing
315 <th>Overflowing
316 <th>Not overflowing
317 </thead>
318 <tr>
319 <th rowspan=3>'overflow/scroll'
320 <th>''scrollbar-gutter/auto''
321 <td>G
322 <td>G
323 <td>
324 <td>
325 <tr>
326 <th>''scrollbar-gutter/stable''
327 <td>G
328 <td>G
329 <td>
330 <td>
331 <tr>
332 <th>''scrollbar-gutter/always''
333 <td>G
334 <td>G
335 <td>G
336 <td>G
337 <tr>
338 <th rowspan=3>''overflow/auto''
339 <th>''scrollbar-gutter/auto''
340 <td>G
341 <td>
342 <td>
343 <td>
344 <tr>
345 <th>''scrollbar-gutter/stable''
346 <td>G
347 <td>G
348 <td>
349 <td>
350 <tr>
351 <th>''scrollbar-gutter/always''
352 <td>G
353 <td>G
354 <td>G
355 <td>G
356 <tr>
357 <th rowspan=3>''overflow/visible'', ''overflow/hidden'', ''overflow/clip''
358 <th>''scrollbar-gutter/auto''
359 <td>
360 <td>
361 <td>
362 <td>
363 <tr>
364 <th>''scrollbar-gutter/stable''
365 <td>f?
366 <td>f?
367 <td>
368 <td>
369 <tr>
370 <th>''scrollbar-gutter/always''
371 <td>f?
372 <td>f?
373 <td>f?
374 <td>f?
375 </table>
376 </div>
378 <h2 id="fragmentation">Fragmentation of overflow</h2>
380 The 'continue' property gives authors the ability
381 to request that content that does not fit inside an element
382 be fragmented (in the sense of [[!CSS3-BREAK]]),
383 and provides alternatives
384 for where the remaining content should continue.
386 Notably, this property explains traditional pagination,
387 and extends it further.
389 <pre class=propdef>
390 Name: continue
391 Value: ''auto'' | ''overflow'' | ''paginate'' | ''fragments'' | ''discard''
392 Initial: auto
393 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
394 Inherited: no
395 Percentages: N/A
396 Media: visual
397 Computed value: see below
398 Animatable: no
399 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
400 </pre>
402 Issue: The naming of this property and its values is preliminary.
403 This was initially proposed as
404 "fragmentation: auto | none | break | clone | page"
405 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>,
406 and there is not yet wide agreement as to which naming is better.
408 Issue: This property is meant to generalize and replace 'region-fragment'.
409 Once it is sufficiently stable in this specification,
410 'region-fragment' should be removed from the regions specification in favor of this.
412 Note: ''continue: fragments'' replaces "overflow:fragments"
413 from earlier versions of this specification,
414 while ''continue: paginate'' replaces "overflow: paged-x | paged-y | paged-x-controls | paged-y-controls"
416 <dl dfn-for="continue" dfn-type="value">
417 <dt><dfn>auto</dfn>
418 <dd>''continue/auto'' may only occur as a computed value
419 if the element is a <a spec="css-regions">CSS Region</a>
420 other than the last one in a <a spec="css-regions">region chain</a>.
421 Content that doesn't fit is pushed to the next region of the chain.
423 In all other cases, ''continue/auto'' computes to one of the other values.
425 <dt><dfn>overflow</dfn>
426 <dd>Content that doesn't fit overflows, according to the 'overflow' property
428 <dt><dfn>discard</dfn>
429 <dd>Content that doesn't fit is discarded at a fragmentation break
431 Note: generalized from region-fragment: break; on the last region of a region chain
433 Issue: When the element isn't a <a spec="css-break">fragmentation container</a> already,
434 should this work by turning it directly into one,
435 or by creating a <a>fragment box</a> inside it like ''continue/fragments'' does?
437 <dt><dfn>paginate</dfn>
438 <dd>Content that doesn't fit paginates.
439 This creates a paginated view inside the element
440 similar to the way that 'overflow: scroll' creates a scrollable view.
442 See <a href="#paginated-overflow">paginated overflow</a>
444 Note: Print is effectively "continue: paginate" on the root.
445 <dt><dfn>fragments</dfn>
446 <dd>content that doesn't fit causes the element to copy itself and continue laying out.
448 See <a href="#fragment-overflow">fragment overflow</a>.
449 </dl>
451 The computed value of the 'continue' for a given element or pseudo element is determined as follow:
452 <ol>
453 <li>On elements or pseudo elements with <a>layout containment</a> (see [[!CSS-CONTAIN-1]]),
454 if the specified value is ''continue/auto'' or ''continue/fragments''
455 then the computed value is ''continue/overflow''.
456 <li>Otherwise, if the specified value is ''continue/auto''
457 <ol>
458 <li>On a <a spec="css-regions">CSS Region</a> other than the last one in a <a spec="css-regions">region chain</a>,
459 the computed value is ''continue/auto''
460 <li>On a page
461 the computed value is ''continue/paginate''
462 <li>On a <a>fragment box</a>
463 the computed value is ''continue/fragments''
464 <li>Otherwise, the computed value is ''continue/overflow''
465 </ol>
466 <li>Otherwise, if the specified value is ''continue/fragments''
467 <ol>
468 <li>On a page
469 the computed value is ''continue/paginate''
470 <li>Otherwise, the computed value is the specified value
471 </ol>
472 <li>In all other cases, the computed value is the specified value
473 </ol>
475 Issue: If we introduce a pseudo element that can select columns in a multicol,
476 we would need to specify that auto computes to auto on it,
477 or introduce a new value and have auto compute to that
478 (but what would that value compute to on things that aren't columns?).
480 Note: For background discussions leading to this property, see these threads:
481 <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
482 <a href="https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html">proposal for a fragmentation property</a>
484 <h2 id="paginated-overflow">Paginated overflow</h2>
486 This section introduces and defines the meaning of the ''continue/paginate'' value of the 'continue' property.
488 Issue: Write this section
490 Issue: Pages should be possible to style with @page rules. How does that work for nested pages?
492 <div class="issue">
493 Should traditional pagination (e.g. when printing)
494 be expressed through some magic in the computed value of ''continue/auto'',
495 or by inserting this in the UA stylesheet:
496 <pre><code class="lang-css">
497 @media (overflow-block: paged), (overflow-block: optional-paged) {
498 :root {
499 continue: paginate;
500 }
501 }
502 </code></pre>
503 </div>
505 Issue: Traditional pagination (e.g. when printing) assumes that
506 :root is contained in the page box,
507 rather than having the page box be a pseudo element child of :root.
508 Can we work around that using something similar to fragment boxes?
509 Or maybe by having a fragment box (reproducing :root) inside a page box inside :root?
511 Issue: How does the page box model work when it is a child of a regular css box?
513 Issue: The initial proposal in [[CSS3GCPM]] and implementation from Opera
514 used 4 values instead of ''continue/paginate'':
515 "paged-x | paged-y | paged-x-controls | paged-y-controls".
516 Should this property also include these values,
517 or are they better handled as separate properties?
518 (e.g.: "pagination-layout: auto | horizontal | vertical", "pagination-controls: auto | none")
520 Issue: Ability to display N pages at once
521 rather than just one page at once?
522 Could this be a value of "pagination-layout", such as:
523 "pagination-layout: horizontal 2;"
525 Issue: Brad Kemper has proposed a model for combining pagination and
526 fragment overflow, which also deals with displaying multiple pages.
527 <a href="http://www.w3.org/mid/[email protected]">http://www.w3.org/mid/[email protected]</a>
529 <p class="issue">
530 The current implementation of paginated overflow uses
531 the overflow/overflow-x/overflow-y properties
532 rather than the overflow-style property as proposed
533 in the [[CSS3GCPM]] draft
534 (which also matches the [[CSS3-MARQUEE]] proposal).
535 or the 'continue' property as described here.
536 </p>
538 <h2 id="fragment-overflow">Fragment overflow</h2>
540 This section introduces and defines the meaning of
541 the ''continue/fragments'' value of the 'continue' property.
543 <p>
544 When the computed value of 'continue' for an element is ''continue/fragments'',
545 and implementations would otherwise have created a box for the element,
546 then implementations must create a sequence of <dfn>fragment box</dfn>es
547 for that element.
548 (It is possible for an element with ''continue: fragments''
549 to generate only one <a>fragment box</a>.
550 However, if an element's computed 'continue' is not ''continue/fragments'',
551 then its box is not a <a>fragment box</a>.)
552 Every <a>fragment box</a> is a fragmentation container,
553 and any overflow
554 that would cause that fragmentation container to fragment
555 causes another <a>fragment box</a> created as a next sibling
556 of the previous one.
557 <span class="issue">Or is it as though it's a next sibling of
558 the element? Need to figure out exactly how this interacts with
559 other box-level fixup.</span>
560 Additionally, if the <a>fragment box</a> is also
561 a multi-column box (as defined in [[!CSS3COL]]
562 <span class="issue">though it defines <i>multi-column element</i></span>)
563 any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
564 instead is flown into an additional fragment box.
565 However, fragment boxes may themselves be broken
566 (due to fragmentation in a fragmentation context outside of them,
567 such as pages, columns, or other fragment boxes);
568 such breaking leads to fragments of the same fragment box
569 rather than multiple fragment boxes.
570 (This matters because fragment boxes may be styled by their index;
571 such breaking leads to multiple fragments of a fragment box
572 with a single index.
573 This design choice is so that
574 breaking a fragment box across pages does not break
575 the association of indices to particular pieces of content.)
576 <span class="issue">Should a forced break that breaks to
577 an outer fragmentation context cause a new fragment of a single
578 fragment box or a new fragment box?</span>
579 <span class="issue">Should we find a term other than
580 <a>fragment box</a> here to make this a little less confusing?</span>
581 </p>
583 <p class="issue">
584 What if we want to be able to style the pieces of an element
585 split within another type of fragmentation context?
586 These rules prevent ever using ''::nth-fragment()'' for that,
587 despite that the name seems the most logical name for such a feature.
588 </p>
590 <div class="example">
591 <table class="source-demo-pair"><tr><td>
592 <pre><code highlight="html"><!DOCTYPE HTML>
593 <title>Breaking content into
594 equal-sized cards</title>
595 <style>
596 .in-cards {
597 continue: fragments;
599 width: 13em;
600 height: 8em;
602 padding: 4px;
603 border: medium solid blue;
604 margin: 6px;
606 font: medium/1.3 Times New
607 Roman, Times, serif;
608 }
609 </style>
610 <div class="in-cards">
611 In this example, the text in the div
612 is broken into a series of cards.
613 These cards all have the same style.
614 The presence of enough content to
615 overflow one of the cards causes
616 another one to be created. The second
617 card is created just like it's the
618 next sibling of the first.
619 </div></code></pre></td><td>
620 <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>
621 <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>
622 </td></tr></table>
623 </div>
625 <p class="issue">
626 We should specify that ''continue: fragments'' does not apply
627 to at least some table parts,
628 and perhaps other elements as well.
629 We need to determine exactly which ones.
630 </p>
632 <p class="issue">
633 This specification needs to say which type of
634 fragmentation context is created
635 so that it's clear which values of the 'break-*' properties
636 cause breaks within this context.
637 We probably want ''break-*: region'' to apply.
638 </p>
640 <p class="issue">
641 This specification needs a processing model
642 that will apply in cases where the layout containing the
643 fragments has characteristics that use the intrinsic size of the fragments
644 to change the amount of space available for them,
645 such as [[CSS3-GRID-LAYOUT]].
646 There has already been some work on such a processing model
647 in [[CSS3-REGIONS]],
648 and the work done on a model there,
649 and the editors of that specification,
650 should inform what happens in this specification.
651 </p>
653 <h3 id="fragment-styling">Fragment styling</h3>
655 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
657 <p>
658 The <dfn selector>::nth-fragment()</dfn> pseudo-element
659 is a pseudo-element
660 that describes some of the <a>fragment box</a>es generated by an element.
661 The argument to the pseudo-element takes the same syntax
662 as the argument to the :nth-child() pseudo-class
663 defined in [[!SELECT]], and has the same meaning
664 except that the number is relative to
665 <a>fragment box</a>es generated by the element
666 instead of siblings of the element.
667 </p>
669 <p class="note">
670 Selectors that allow addressing fragments
671 by counting from the end rather than the start
672 are intentionally not provided.
673 Such selectors would interfere with determining
674 the number of fragments.
675 </p>
677 <p class="issue">
678 Depending on future discussions,
679 this ''::nth-fragment(<var>an+b</var>)'' syntax
680 may be replaced with
681 the new ''::fragment:nth(<var>an+b</var>)'' syntax.
682 </p>
684 <h4 id="style-of-fragments">Styling of fragments</h4>
686 <p class="issue">
687 Should this apply to continue:fragments only,
688 or also to continue:paginate?
689 (If it applies,
690 then stricter property restrictions would be needed
691 for continue:paginate.)
692 </p>
694 <p>
695 In the absence of rules with ''::nth-fragment()'' pseudo-elements,
696 the computed style for each <a>fragment box</a>
697 is the computed style for the element
698 for which the <a>fragment box</a> was created.
699 However, the style for a <a>fragment box</a> is also influenced
700 by rules whose selector's <a>subject</a> [[!SELECT]]
701 has an ''::nth-fragment()'' pseudo-element,
702 if the 1-based number of the <a>fragment box</a> matches
703 that ''::nth-fragment()'' pseudo-element
704 and the selector (excluding the ''::nth-fragment()'' pseudo-element)
705 matches the element generating the fragments.
706 </p>
708 <p>
709 When determining the style of the <a>fragment box</a>,
710 these rules that match the fragment pseudo-element
711 cascade together with the rules that match the element,
712 with the fragment pseudo-element adding the specificity
713 of a pseudo-class to the specificity calculation.
714 <span class="issue">Does this need to be specified in
715 the cascading module as well?</span>
716 </p>
718 <div class="example">
719 <table class="source-demo-pair"><tr><td>
720 <pre><code highlight="html"><!DOCTYPE HTML>
721 <style>
722 .bouncy-columns {
723 continue: fragments;
724 width: 6em;
725 height: 10em;
726 float: left;
727 margin: 1em;
728 font: medium/1.25 Times New
729 Roman, Times, serif;
730 }
731 .bouncy-columns::nth-fragment(1) {
732 background: aqua; color: black;
733 transform: rotate(-3deg);
734 }
735 .bouncy-columns::nth-fragment(2) {
736 background: yellow; color: black;
737 transform: rotate(3deg);
738 }
739 </style>
740 <div class="bouncy-columns">
741 <i>...</i>
742 </div></code></pre></td><td>
743 <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>
744 <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>
745 <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>
746 </td></tr></table>
747 </div>
749 <p>
750 Styling an ''::nth-fragment()'' pseudo-element with the 'continue'
751 property does take effect;
752 if a <a>fragment box</a> has a
753 computed value of 'continue' other than ''fragments''
754 then that fragment box is the last fragment.
755 However, overriding 'continue' on the first fragment
756 does not cause the <a>fragment box</a> not to exist;
757 whether there are fragment boxes at all is determined by
758 the computed value of overflow for the element.
759 </p>
761 <p>
762 Styling an ''::nth-fragment()'' pseudo-element with the 'content'
763 property has no effect;
764 the computed value of 'content' for the fragment box
765 remains the same as the computed value of content for the element.
766 </p>
768 <p>
769 Specifying ''display: none'' for a <a>fragment box</a> causes
770 the fragment box with that index not to be generated.
771 However, in terms of the indices
772 used for matching ''::nth-fragment()'' pseudo-elements
773 of later fragment boxes,
774 it still counts as though it was generated.
775 However, since it is not generated, it does not contain any content.
776 </p>
778 <p>
779 Specifying other values of 'display', 'position',
780 or 'float' is permitted, but is not allowed to change
781 the <a>inner display type</a>.
782 (Since 'continue' only
783 applies to block containers, flex containers, and grid containers).
784 <span class="issue">Need to specify exactly how this works</span>
785 </p>
787 <p>
788 To match the model for other pseudo-elements
789 where the pseudo-elements live inside their corresponding element,
790 declarations in ''::nth-fragment()'' pseudo-elements override
791 declarations in rules without the pseudo-element.
792 The relative priority within such declarations is determined
793 by normal cascading order (see [[!CSS21]]).
794 </p>
796 <p>
797 Styles specified on ''::nth-fragment()'' pseudo-elements
798 do affect inheritance to content within the <a>fragment box</a>.
799 In other words, the content within the <a>fragment box</a> must
800 inherit from the fragment box's style (i.e., the pseudo-element style)
801 rather than directly from the element.
802 This means that elements split between fragment boxes may
803 have different styles for different parts of the element.
804 </p>
806 <p class="issue">
807 This inheritance rule allows specifying styles indirectly
808 (by using explicit ''inherit'' or using default inheritance
809 on properties that don't apply to ''::first-letter'')
810 that can't be specified directly
811 (based on the rules in the next section).
812 This is a problem.
813 The restrictions that apply to styling inside fragments
814 should also apply to inheritance from fragments.
815 </p>
817 <div class="example">
818 <table class="source-demo-pair"><tr><td>
819 <pre><code highlight="html"><!DOCTYPE HTML>
820 <style>
821 .article {
822 continue: fragments;
823 }
824 .article::nth-fragment(1) {
825 font-size: 1.5em;
826 margin-bottom: 1em;
827 height: 4em;
828 }
829 .article::nth-fragment(2) {
830 margin-left: 5em;
831 margin-right: 2em;
832 }
833 </style>
834 <div class="article">
835 The <code>font-size</code> property<i>...</i>
836 </div></code></pre></td><td>
837 <div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
838 <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>
839 </td></tr></table>
840 </div>
842 <h4 id="style-in-fragments">Styling inside fragments</h4>
844 <p class="issue">
845 Should this apply to continue:fragments only,
846 or also to continue:paginate?
847 </p>
849 <p>
850 The ''::nth-fragment()'' pseudo-element
851 can also be used to style
852 content inside of a <a>fragment box</a>.
853 Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
854 the ''::nth-fragment()'' pseudo-element can be applied
855 to parts of the selector other than the subject:
856 in particular, it can match ancestors of the subject.
857 However, the only CSS properties applied
858 by rules with such selectors
859 are those that apply
860 to the ''::first-letter'' pseudo-element.
861 </p>
863 <p>
864 To be more precise,
865 when a rule's selector has ''::nth-fragment()'' pseudo-elements
866 attached to parts of the selector other than the subject,
867 the declarations in that rule apply to
868 a fragment (or pseudo-element thereof) when:
869 </p>
870 <ol>
871 <li>
872 the declarations are for properties that apply to the
873 ''::first-letter'' pseudo-element,
874 </li>
875 <li>
876 the declarations would apply to
877 that fragment (or pseudo-element thereof)
878 had those ''::nth-fragment()'' pseudo-elements been removed,
879 with a particular association between
880 each sequence of simple selectors and the element it matched,
881 and
882 </li>
883 <li>
884 for each removed ''::nth-fragment()'' pseudo-element,
885 the fragment lives within a <a>fragment box</a>
886 of the element associated in that association
887 with the selector that the pseudo-element was attached to,
888 and whose index matches the pseudo-element.
889 </li>
890 </ol>
892 <div class="example">
893 <table class="source-demo-pair"><tr><td>
894 <pre><code highlight="html"><!DOCTYPE HTML>
895 <style>
896 .dark-columns {
897 continue: fragments;
898 width: 6em;
899 height: 10em;
900 float: left;
901 margin-right: 1em;
902 font: medium/1.25 Times New
903 Roman, Times, serif;
904 }
905 .dark-columns::nth-fragment(1) {
906 background: aqua; color: black;
907 }
908 .dark-columns::nth-fragment(1) :link {
909 color: blue;
910 }
911 .dark-columns::nth-fragment(1) :visited {
912 color: purple;
913 }
914 .dark-columns::nth-fragment(2) {
915 background: navy; color: white;
916 }
917 .dark-columns::nth-fragment(2) :link {
918 color: aqua;
919 }
920 .dark-columns::nth-fragment(2) :visited {
921 color: fuchsia;
922 }
923 </style>
924 <div class="dark-columns">
925 <i>...</i>
926 </div></code></pre></td><td>
927 <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>
928 <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>
929 </td></tr></table>
930 </div>
933 <h3 id="max-lines">The 'max-lines' property</h3>
935 <p>
936 Authors may wish to style the opening lines of an element
937 with different styles
938 by putting those opening lines in a separate fragment.
939 However, since it may be difficult to predict the exact height
940 occupied by those lines
941 in order to restrict the first fragment to that height,
942 this specification introduces a 'max-lines' property
943 that forces a fragment to break
944 after a specified number of lines.
945 This forces a break after the given number of lines
946 contained within the element or its descendants,
947 as long as those lines are in the same block formatting context.
948 </p>
950 <pre class=propdef>
951 Name: max-lines
952 Value: none | <<integer>>
953 Initial: none
954 Applies to: fragment boxes
955 Inherited: no
956 Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
957 Percentages: N/A
958 Media: visual
959 Computed value: specified value
960 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
961 </pre>
963 <dl dfn-for="max-lines" dfn-type="value">
964 <dt><dfn>none</dfn>
965 <dd>
966 <p>
967 Breaks occur only as specified elsewhere.
968 </p>
969 </dd>
971 <dt><dfn><<integer>></dfn>
972 <dd>
973 <p>
974 In addition to any breaks specified elsewhere,
975 a break is forced before any line that would exceed
976 the given number of lines
977 being placed inside the element
978 (excluding lines that are in
979 a different block formatting context from
980 the block formatting context to which
981 an unstyled child of the element would belong).
982 </p>
984 <p class="issue">
985 If there are multiple boundaries between this line
986 and the previous, where exactly (in terms of element
987 boundaries) is the break forced?
988 </p>
990 <p>
991 Only positive integers are accepted.
992 Zero or negative integers are a parse error.
993 </p>
994 </dd>
995 </dl>
997 <p class="issue">Should this apply to fragment overflow only, or also
998 to pagination?
999 Given what we're doing with the continue property,
1000 it should actually apply to any fragmentainer.</p>
1002 Issue: having max-lines do nothing on regular elements is not ideal.
1003 When applied to non fragmentainers,
1004 it should probably cause 'continue' to compute to ''continue/discard''
1005 so that you only need to reach for one property rather than 2 to get
1006 that effect.
1008 <div class="example">
1009 <table class="source-demo-pair"><tr><td>
1010 <pre><code highlight="html"><!DOCTYPE HTML>
1011 <style>
1012 .article {
1013 continue: fragments;
1014 }
1015 .article::first-letter {
1016 font-size: 2em;
1017 line-height: 0.9;
1018 }
1019 .article::nth-fragment(1) {
1020 font-size: 1.5em;
1021 max-lines: 3;
1022 }
1023 .article::nth-fragment(2) {
1024 column-count: 2;
1025 }
1026 </style>
1027 <div class="article">
1028 <i>...</i>
1029 </div></code></pre></td><td>
1030 <div class="article-max-lines-demo one">The max-lines property allows<br>authors to use a larger font for the first<br>few lines of an article. Without the</div>
1031 <div class="article-max-lines-demo two">max-lines property, authors<br>might have to use the<br>'height' property instead, but<br>that would leave a slight gap<br>if the author miscalculated<br>how much height a given<br>number of lines would<br>occupy (which might be</div>
1032 <div class="article-max-lines-demo three">particularly hard if the author<br>didn't know what text would<br>be filling the space, exactly<br>what font would be used, or<br>exactly which platform's font<br>rendering would be used to<br>display the font).</div>
1033 </td></tr></table>
1034 </div>
1036 Privacy and Security Considerations {#priv-sec}
1037 ===============================================
1039 This specification introduces no new security considerations.
1041 The <a href="http://www.w3.org/2001/tag/">TAG</a> has developed a <a href="https://www.w3.org/TR/security-privacy-questionnaire/">self-review questionnaire</a>
1042 to help editors and Working Groups evaluate the risks introduced by their specifications.
1043 Answers are provided below.
1045 <dl>
1046 <dt>Does this specification deal with personally-identifiable information?
1047 <dd>No.
1049 <dt>Does this specification deal with high-value data?
1050 <dd>No.
1052 <dt>Does this specification introduce new state for an origin that persists across browsing sessions?
1053 <dd>No.
1055 <dt>Does this specification expose persistent, cross-origin state to the web?
1056 <dd>No.
1058 <dt>Does this specification expose any other data to an origin that it doesnât currently have access to?
1059 <dd>No.
1061 <dt>Does this specification enable new script execution/loading mechanisms?
1062 <dd>No.
1064 <dt>Does this specification allow an origin access to a userâs location?
1065 <dd>No.
1067 <dt>Does this specification allow an origin access to sensors on a userâs device?
1068 <dd>No.
1070 <dt>Does this specification allow an origin access to aspects of a userâs local computing environment?
1071 <dd>No.
1073 <dt>Does this specification allow an origin access to other devices?
1074 <dd>No.
1076 <dt>Does this specification allow an origin some measure of control over a user agentâs native UI?
1077 <dd>No
1079 <dt>Does this specification expose temporary identifiers to the web?
1080 <dd>No.
1082 <dt>Does this specification distinguish between behavior in first-party and third-party contexts?
1083 <dd>No.
1085 <dt>How should this specification work in the context of a user agentâs "incognito" mode?
1086 <dd>No difference in behavior is needed.
1088 <dt>Does this specification persist data to a userâs local device?
1089 <dd>No.
1091 <dt>Does this specification have a "Security Considerations" and "Privacy Considerations" section?
1092 <dd>Yes, this is the section you are currently reading.
1094 <dt>Does this specification allow downgrading default security characteristics?
1095 <dd>No.
1096 </dl>
1098 <h2 id="changes" class="no-num">
1099 Changes</h2>
1100 <h3 id="changes-l3">
1101 Changes Since Level 3</h3>
1103 The following changes were made to this specification since the
1104 <a href="https://drafts.csswg.org/css-overflow-3/">CSS Overflow Module Level 3</a>:
1106 <ul>
1107 <li>The Fragmentation of overflow, Paginated overflow, and Fragment overflow sections and subsections have been removed form Level 3 and moved to Level 4.
1108 <li>The 'scrollbar-gutter' property has been added.
1109 </ul>
1111 <h2 class=no-num id="acknowledgments">
1112 Acknowledgments</h2>
1114 <p>
1115 Thanks especially to the feedback from
1116 Rossen Atanassov,
1117 Bert Bos,
1118 Tantek Ãelik,
1119 John Daggett,
1120 fantasai,
1121 Daniel Glazman,
1122 Vincent Hardy,
1123 Håkon Wium Lie,
1124 Peter Linss,
1125 Robert O'Callahan,
1126 Florian Rivoal,
1127 Alan Stearns,
1128 Steve Zilles,
1129 and all the rest of the
1130 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.