Thu, 04 Feb 2016 09:45:32 +1100
Update affiliation
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, http://dbaron.org/
12 Editor: Florian Rivoal, On behalf of Bloomberg, [email protected], 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 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.bs">from 27 January 2015 to the present</a>
15 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.src.html">from 28 March 2013 to 27 January 2015</a>
16 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css3-overflow/Overview.src.html">from 31 July 2012 to 27 March 2013</a>
17 Ignored Terms: display-inside, display-outside
18 </pre>
19 <!-- FIXME: Regressions from bikeshed conversion: -->
20 <!-- - Value lines in propdef tables no longer link to #values. -->
21 <!-- - no longer says "Test suite: none yet" -->
22 <!-- - Abstract has the most introductory sentence last -->
23 <!-- FIXME: other bikeshed issues -->
24 <pre class="link-defaults">
25 spec:css-transforms-1; type:property; text:transform-style
26 type: dfn; spec:css-multicol-1; text:overflow column
27 </pre>
28 <!-- FIXME: the break-* link doesn't actually work! -->
29 <pre class="anchors">
30 url: https://www.w3.org/TR/2008/CR-css3-marquee-20081205/#the-overflow-style; type: property; text: overflow-style;
31 url: https://drafts.csswg.org/selectors-3/#subject; type: dfn; text: subject;
32 url: https://drafts.csswg.org/css-containment/#propdef-contain; type: property; text: contain
33 url: https://drafts.csswg.org/css-containment/#paint-containment; type: dfn; text: paint containment
34 </pre>
35 <style>
36 table.source-demo-pair {
37 width: 100%;
38 }
40 .in-cards-demo {
41 width: 13em;
42 height: 8em;
44 padding: 4px;
45 border: medium solid blue;
46 margin: 6px;
48 font: medium/1.3 Times New Roman, Times, serif;
49 white-space: nowrap;
50 }
52 .bouncy-columns-demo {
53 width: 6em;
54 height: 10em;
55 float: left;
56 margin: 1em;
57 font: medium/1.25 Times New Roman, Times, serif;
58 white-space: nowrap;
59 }
60 .bouncy-columns-demo.one {
61 background: aqua; color: black;
62 transform: rotate(-3deg);
63 }
64 .bouncy-columns-demo.two {
65 background: yellow; color: black;
66 transform: rotate(3deg);
67 }
69 .article-font-inherit-demo {
70 font: 1em/1.25 Times New Roman, Times, serif;
71 white-space: nowrap;
72 }
73 .article-font-inherit-demo.one {
74 width: 12em;
75 font-size: 1.5em;
76 margin-bottom: 1em;
77 height: 4em;
78 }
79 .article-font-inherit-demo.two {
80 width: 11em;
81 margin-left: 5em;
82 margin-right: 2em;
83 }
85 .dark-columns-demo {
86 width: 6em;
87 height: 10em;
88 float: left;
89 margin-right: 1em;
90 font: medium/1.25 Times New Roman, Times, serif;
91 white-space: nowrap;
92 }
93 .dark-columns-demo.one {
94 background: aqua; color: black;
95 }
96 .dark-columns-demo.one :link {
97 color: blue;
98 }
99 .dark-columns-demo.one :visited {
100 color: purple;
101 }
102 .dark-columns-demo.two {
103 background: navy; color: white;
104 }
105 .dark-columns-demo.two :link {
106 color: aqua;
107 }
108 .dark-columns-demo.two :visited {
109 color: fuchsia;
110 }
112 .article-max-lines-demo {
113 font: 1em/1.25 Times New Roman, Times, serif;
114 white-space: nowrap;
115 }
116 .article-max-lines-demo.one::first-letter {
117 font-size: 2em;
118 line-height: 0.9;
119 }
120 .article-max-lines-demo.one {
121 font-size: 1.5em;
122 width: 16em;
123 }
124 .article-max-lines-demo.two {
125 width: 11.5em;
126 float: left; margin-right: 1em;
127 }
128 .article-max-lines-demo.three {
129 width: 11.5em;
130 float: left;
131 }
132 </style>
134 <p>
135 </p>
137 <h2 id="intro">
138 Introduction</h2>
140 <p>
141 In CSS Level 1 [[CSS1]], placing more content than would fit
142 inside an element with a specified size
143 was generally an authoring error.
144 Doing so caused the content to extend
145 outside the bounds of the element,
146 which would likely cause
147 that content to overlap with other elements.
148 </p>
150 <p>
151 CSS Level 2 [[CSS21]] introduced the 'overflow' property,
152 which allows authors to have overflow be handled by scrolling,
153 which means it is no longer an authoring error.
154 It also allows authors to specify
155 that overflow is handled by clipping,
156 which makes sense when the author's intent
157 is that the content not be shown.
158 </p>
160 <p>
161 However, scrolling is not the only way
162 to present large amounts of content,
163 and may even not be the optimal way.
164 After all, the codex replaced the scroll
165 as the common format for large written works
166 because of its advantages.
167 </p>
169 <p>
170 This specification introduces
171 a mechanism for Web pages to specify
172 that an element of a page should handle overflow
173 through pagination rather than through scrolling.
174 </p>
176 <p>
177 This specification also extends the concept of overflow
178 in another direction.
179 Instead of requiring that authors specify a single area
180 into which the content of an element must flow,
181 this specification allows authors to specify multiple fragments,
182 each with their own dimensions and styles,
183 so that the content of the element can flow from one to the next,
184 using as many as needed to place the content without overflowing.
185 </p>
187 <p>
188 In both of these cases, implementations must
189 break the content in the block-progression dimension.
190 Implementations must do this is described
191 in the CSS Fragmentation Module [[!CSS3-BREAK]].
192 </p>
194 <h2 id="overflow-concepts">Types of overflow</h2>
196 <p>
197 CSS uses the term <dfn>overflow</dfn> to describe
198 the contents of a box
199 that extend outside that one of that box's edges
200 (i.e., its <i>content edge</i>, <i>padding edge</i>,
201 <i>border edge</i>, or <i>margin edge</i>).
202 The overflow might be described as the elements or features
203 that cause this overflow,
204 the non-rectangular region occupied by these features,
205 or, more commonly,
206 as the minimal rectangle that bounds that region.
207 A box's overflow is computed based on the boxes and styles
208 of the box and of all its descendants whose containing block chain
209 <span class="issue">undefined term?</span>
210 includes the box.
211 </p>
213 <p>
214 In most cases, any of these types of overflow
215 can be computed for any box
216 from the bounds and properties of that box,
217 and from the overflow (of that type)
218 of each of its children.
219 However, this is not always the case; for example,
220 when ''transform-style: preserve-3d'' [[CSS3-TRANSFORMS]] is used on
221 some of the children, their descendants with
222 ''transform-style: preserve-3d'' must also be examined.
223 </p>
225 <h3 id="ink-overflow">Ink overflow</h3>
227 <p>
228 The <dfn id="ink-overflow0">ink overflow</dfn> of a box
229 is the part of that box and its contents that
230 creates a visual effect outside of
231 the box's border box.
232 </p>
234 <p>
235 Since some effects in CSS (for example, the blurs in
236 'text-shadow' [[CSS3TEXT]] and 'box-shadow' [[CSS3BG]])
237 do not define what visual extent they cover, the extent
238 of the <a>ink overflow</a> is undefined.
239 </p>
241 <p class="issue">
242 Should we try to define it at all and just leave pieces undefined?
243 </p>
245 <p>
246 The <dfn>ink overflow region</dfn> is the non-rectangular region
247 occupied by the <a>ink overflow</a>, and the
248 <dfn>ink overflow rectangle</dfn> is
249 the minimal rectangle whose axis is aligned to the box's axes
250 and contains the <a>ink overflow region</a>.
251 Note that the <a>ink overflow rectangle</a> is a rectangle
252 in the box's coordinate system, but might be non-rectangular
253 in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
254 </p>
256 <h3 id="scrollable-overflow">Scrollable overflow</h3>
258 <p>
259 The <dfn id="scrollable-overflow0">scrollable overflow</dfn> of a box is the
260 set of things extending outside of that box's padding edge
261 for which a scrolling mechanism needs to be provided.
262 </p>
264 <p class="issue">
265 The following definition should be rewritten to use
266 the concept of <a href="https://drafts.csswg.org/css-transforms/#3d-rendering-context">3D rendering context</a> [[!CSS3-TRANSFORMS]]
267 and related terms,
268 particularly once those concepts stabilize following changes
269 proposed in the CSS WG meeting on the morning of 2014-01-28.
270 </p>
272 <p>
273 Given the following definitions
274 <span class="issue">which belong in [[CSS3-TRANSFORMS]]</span>:
275 </p>
277 <dl>
278 <dt><dfn>3d-preserving child</dfn></dt>
279 <dd>
280 A child box B of a containing block C is a 3d-preserving
281 child if it has ''transform-style: preserve-3d''
282 and the user-agent is not required to flatten it
283 based on the <a href="https://www.w3.org/TR/css3-transforms/#transform-style-property">requirements</a> in [[!CSS3-TRANSFORMS]].
284 </dt>
285 <dt><dfn>non-3d-preserving child</dfn></dt>
286 <dd>
287 A child C of a box P is a non-3d-preserving-child if
288 it is not a <a>3d-preserving child</a>.
289 </dd>
290 <dt><dfn>3d-preserving descendant</dfn></dt>
291 <dd>
292 Box D is a 3d-preserving descendant of box A if A is
293 an ancestor of D, and D and all of the boxes (if any)
294 in the containing block chain from D to A
295 are <a>3d-preserving child</a> boxes.
296 </dd>
297 </dl>
299 <p>The scrollable overflow of a box is the union of the following things,
300 all adjusted for transforms <span class="issue">undefined concept!</span> into the box's coordinate space:</p>
302 <ul>
303 <li>
304 for the box and all of its <a>3d-preserving descendant</a> boxes:
305 <ul>
306 <li>the box's own padding edge (for the box itself) or border edge (for <a>3d-preserving descendant</a> boxes)</li>
307 <li>the bounds <span class="issue">undefined term!</span> of any text directly in the box</li>
308 <li><span class="issue">MORE HERE!</span>
309 </ul>
310 <li>
311 for all the <a>non-3d-preserving child</a> boxes of the
312 box and its <a>3d-preserving descendant</a> boxes,
313 the scrollable overflow of the box
314 </li>
315 </ul>
317 <p class="issue">
318 I wrote this definition off the top of my head,
319 so it can't possibly be right.
320 It's missing tons of pieces!
321 </p>
323 <p class="issue">
324 The handling of preserve-3d subtrees here is probably wrong;
325 the elements should probably count
326 only towards the overflow of the element that flattens them.
327 </p>
329 <p>
330 The <dfn>scrollable overflow region</dfn> is the non-rectangular region
331 occupied by the <a>scrollable overflow</a>, and the
332 <dfn>scrollable overflow rectangle</dfn> is
333 the minimal rectangle whose axis is aligned to the box's axes
334 and contains the <a>scrollable overflow region</a>.
335 Note that the <a>scrollable overflow rectangle</a> is a rectangle
336 in the box's coordinate system, but might be non-rectangular
337 in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
338 </p>
340 <h3 id="border-box-overflow">Border box overflow</h3>
342 <p class="issue">
343 This concept has been proposed for some uses, such as for
344 determining what the 'outline' property goes around, and
345 as the basis of a coordinate system for specifying clips and masks,
346 but it's not clear if it's needed.
347 </p>
349 <p>
350 The <dfn>border-box overflow</dfn> of a box is the
351 union of the box's border edge and the border edges of
352 the box's descendants.</p>
353 </p>
355 <p class="issue">
356 If needed, define more formally, as for scrollable overflow above.
357 (Maybe even share the definitions in an appropriate way!)
358 </p>
360 <p>
361 The <dfn>border-box overflow region</dfn> is the non-rectangular region
362 occupied by the <a>border-box overflow</a>, and the
363 <dfn>border-box overflow rectangle</dfn> is
364 the minimal rectangle whose axis is aligned to the box's axes
365 and contains the <a>border-box overflow region</a>.
366 Note that the <a>border-box overflow rectangle</a> is a rectangle
367 in the box's coordinate system, but might be non-rectangular
368 in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
369 </p>
371 <h2 id="overflow-properties">Overflow properties</h2>
373 <p>
374 The 'overflow-x' property specifies
375 the handling of overflow in the horizontal direction
376 (i.e., overflow from the left and right sides of the box),
377 and the 'overflow-y' property specifies the handling
378 of overflow in the vertical direction
379 (i.e., overflow from the top and bottom sides of the box)
380 </p>
382 <pre class=propdef>
383 Name: overflow-x, overflow-y
384 Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
385 Initial: ''visible''
386 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
387 Inherited: no
388 Percentages: N/A
389 Media: visual
390 Computed value: see below
391 Animatable: no
392 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
393 </pre>
395 <p>
396 The 'overflow' property is a shorthand property
397 that sets the specified values of both 'overflow-x' and 'overflow-y'
398 to the value specified for 'overflow'.
399 </p>
401 <pre class=propdef>
402 Name: overflow
403 Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
404 Initial: see individual properties
405 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
406 Inherited: no
407 Percentages: N/A
408 Media: visual
409 Computed value: see individual properties
410 Animatable: no
411 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
412 </pre>
414 <div id="overflow-computed-values">
415 <p>The computed values of 'overflow-x' and 'overflow-y'
416 are determined from the cascaded values [[!CSS3CASCADE]]
417 based on the following rules:</p>
419 <ol>
420 <li>
421 If one cascaded values is ''overflow/visible''
422 and the other is not,
423 then computed values are the cascaded values
424 with ''overflow/visible'' changed to ''overflow/auto''.
425 </li>
426 <li>
427 Otherwise, if both cascaded values are ''overflow/visible''
428 and the computed value of 'contain' is
429 one that activates <a>paint containment</a>
430 (e.g. ''contain:strict''
431 or ''contain: paint''
432 or ''contain: layout paint''â¦),
433 then the computed values of both 'overflow-x' and 'overflow-y'
434 are changed to ''overflow/clip''.</li>
435 <li>
436 Otherwise, the computed values are as specified.
437 </li>
438 </ol>
439 </div>
441 <p>The values of these properties are:</p>
443 <dl dfn-for="overflow, overflow-x, overflow-y" dfn-type="value">
444 <dt><dfn>visible</dfn>
445 <dd>
446 There is no special handling of overflow, that is, it
447 may be rendered outside the block container.
448 </dd>
449 <dt><dfn>hidden</dfn>
450 <dd>This value indicates that
451 the content is clipped and that no scrolling user interface should be provided by the UA
452 to view the content outside the clipping region.
453 However, the content may still be scrolled programatically,
454 for example using the mechanisms defined in [[CSSOM-VIEW]].
455 <dt><dfn>clip</dfn>
456 <dd>Like ''hidden'',
457 this value indicates that
458 the content is clipped
459 and that no scrolling user interface should be provided by the UA
460 to view the content outside the clipping region.
461 In addition, unlike ''overflow: hidden''
462 which still allows programmatic scrolling,
463 ''overflow: clip'' forbids scrolling entirely,
464 through any mechanism.
466 Issue: Mozilla implements -moz-hidden-unscrollable,
467 which is similar to ''clip'',
468 except that it does not cause the element to establish a BFC.
469 Should we match that?
470 <dt><dfn>scroll</dfn>
471 <dd>This value indicates that the content is clipped
472 and that if the user agent uses a scrolling mechanism
473 that is visible on the screen (such as a scroll bar or a panner),
474 that mechanism should be displayed for a box
475 whether or not any of its content is clipped.
476 This avoids any problem with scrollbars appearing
477 and disappearing in a dynamic environment.
478 When this value is specified and the target medium is ''print'',
479 overflowing content may be printed.
480 <dt><dfn>auto</dfn>
481 <dd>The behavior of the ''overflow/auto'' value is user agent-dependent,
482 but should cause a scrolling mechanism to be provided for overflowing boxes.
483 </dl>
485 Even if 'overflow' is set to ''overflow/visible'',
486 content may be clipped to a UA's document window by the native operating environment.
488 If the computed value of 'overflow' is not ''overflow/visible'',
489 the element creates a block formatting context.
491 UAs must apply the 'overflow' property
492 set on the root element to the viewport.
493 HTML UAs must instead apply the âoverflowâ property
494 from the <{body}> element to the viewport
495 if the value on the root element is ''visible''.
496 The ''visible'' value when used for the viewport
497 must be interpreted as ''overflow/auto''.
498 The element from which the value is propagated
499 must have a used value for 'overflow' of ''visible''.
501 In the case of a scrollbar being placed on an edge of the element's box,
502 it should be inserted between the inner border edge
503 and the outer padding edge.
504 Any space taken up by the scrollbars should be
505 taken out of (subtracted from the dimensions of)
506 the containing block formed by the element with the scrollbars.
508 Issue: import examples from [[CSS3-BOX]].
510 <p class="issue">
511 Explain which directions allow scrolling and which don't,
512 as a function of 'direction'
513 (including propagation of 'direction' to the ICB).
514 </p>
517 <p class="issue">
518 [[CSS3-MARQUEE]] describes an 'overflow-style' property,
519 but it has not picked up implementation experience
520 that the working group is aware of.
521 Should this document treat 'overflow-style' as a defunct proposal,
522 or should this document describe the 'overflow-style' property
523 and attempt to revive it,
524 despite that implementations have implemented
525 'overflow-x' and 'overflow-y' instead?
526 </p>
528 <h2 id="fragmentation">Fragmentation of overflow</h2>
530 The 'continue' property gives authors the ability
531 to request that content that does not fit inside an element
532 be fragmented (in the sense of [[!CSS3-BREAK]]),
533 and provides alternatives
534 for where the remaining content should continue.
536 Notably, this property explains traditional pagination,
537 and extends it further.
539 <pre class=propdef>
540 Name: continue
541 Value: ''auto'' | ''overflow'' | ''paginate'' | ''fragments'' | ''discard''
542 Initial: auto
543 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
544 Inherited: no
545 Percentages: N/A
546 Media: visual
547 Computed value: see below
548 Animatable: no
549 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
550 </pre>
552 Issue: The naming of this property and its values is preliminary.
553 This was initially proposed as
554 "fragmentation: auto | none | break | clone | page"
555 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>,
556 and there is not yet wide agreement as to which naming is better.
558 Issue: This property is meant to generalize and replace 'region-fragment'.
559 Once it is sufficiently stable in this specification,
560 'region-fragment' should be removed from the regions specification in favor of this.
562 Note: ''continue: fragments'' replaces "overflow:fragments"
563 from earlier versions of this specification,
564 while ''continue: paginate'' replaces "overflow: paged-x | paged-y | paged-x-controls | paged-y-controls"
566 <dl dfn-for="continue" dfn-type="value">
567 <dt><dfn>auto</dfn>
568 <dd>''continue/auto'' may only occur as a computed value
569 if the element is a <a spec="css-regions">CSS Region</a>
570 other than the last one in a <a spec="css-regions">region chain</a>.
571 Content that doesn't fit is pushed to the next region of the chain.
573 In all other cases, ''continue/auto'' computes to one of the other values.
575 <dt><dfn>overflow</dfn>
576 <dd>Content that doesn't fit overflows, according to the 'overflow' property
578 <dt><dfn>discard</dfn>
579 <dd>Content that doesn't fit is discarded at a fragmentation break
581 Note: generalized from region-fragment: break; on the last region of a region chain
583 Issue: When the element isn't a <a spec="css-break">fragmentation container</a> already,
584 should this work by turning it directly into one,
585 or by creating a <a>fragment box</a> inside it like ''continue/fragments'' does?
587 <dt><dfn>paginate</dfn>
588 <dd>Content that doesn't fit paginates.
589 This creates a paginated view inside the element
590 similar to the way that 'overflow: scroll' creates a scrollable view.
592 See <a href="#paginated-overflow">paginated overflow</a>
594 Note: Print is effectively "continue: paginate" on the root.
595 <dt><dfn>fragments</dfn>
596 <dd>content that doesn't fit causes the element to copy itself and continue laying out.
598 See <a href="#fragment-overflow">fragment overflow</a>.
599 </dl>
601 The computed value of the 'continue' for a given element or pseudo element is determined as follow:
602 <ol>
603 <li>If the specified value is ''continue/auto''
604 <ol>
605 <li>On a <a spec="css-regions">CSS Region</a> other than the last one in a <a spec="css-regions">region chain</a>,
606 the computed value is ''continue/auto''
607 <li>On a page
608 the computed value is ''continue/paginate''
609 <li>On a <a>fragment box</a>
610 the computed value is ''continue/fragments''
611 <li>Otherwise, the computed value is ''continue/overflow''
612 </ol>
613 <li>If the specified value is ''continue/framgents''
614 <ol>
615 <li>On a page
616 the computed value is ''continue/paginate''
617 <li>Otherwise, the computed value is the specified value
618 </ol>
619 <li>In all other cases, the computed value is the specified value
620 </ol>
622 Issue: If we introduce a pseudo element that can select columns in a multicol,
623 we would need to specify that auto computes to auto on it,
624 or introduce a new value and have auto compute to that
625 (but what would that value compute to on things that aren't columns?).
627 Note: For background discussions leading to this property, see these threads:
628 <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
629 <a href="https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html">proposal for a fragmentation property</a>
631 <h2 id="paginated-overflow">Paginated overflow</h2>
633 This section introduces and defines the meaning of the ''continue/paginate'' value of the 'continue' property.
635 Issue: Write this section
637 Issue: Pages should be possible to style with @page rules. How does that work for nested pages?
639 <div class="issue">
640 Should traditional pagination (e.g. when printing)
641 be expressed through some magic in the computed value of ''continue/auto'',
642 or by inserting this in the UA stylesheet:
643 <pre><code class="lang-css">
644 @media (overflow-block: paged), (overflow-block: optional-paged) {
645 :root {
646 continue: paginate;
647 }
648 }
649 </code></pre>
650 </div>
652 Issue: Traditional pagination (e.g. when printing) assumes that
653 :root is contained in the page box,
654 rather than having the page box be a pseudo element child of :root.
655 Can we work around that using something similar to fragment boxes?
656 Or maybe by having a fragment box (reproducing :root) inside a page box inside :root?
658 Issue: How does the page box model work when it is a child of a regular css box?
660 Issue: The initial proposal in [[CSS3GCPM]] and implemantation from Opera
661 used 4 values instead of ''continue/paginate'':
662 "paged-x | paged-y | paged-x-controls | paged-y-controls".
663 Should this property also include these values,
664 or are they better handled as separate properties?
665 (e.g.: "pagination-layout: auto | horizontal | vertical", "pagination-controls: auto | none")
667 Issue: Ability to display N pages at once
668 rather than just one page at once?
669 Could this be a value of "pagination-layout", such as:
670 "pagination-layout: horizontal 2;"
672 Issue: Brad Kemper has proposed a model for combining pagination and
673 fragment overflow, which also deals with displaying multiple pages.
674 <a href="http://www.w3.org/mid/[email protected]">http://www.w3.org/mid/[email protected]</a>
676 <p class="issue">
677 The current implementation of paginated overflow uses
678 the 'overflow'/'overflow-x'/'overflow-y' properties
679 rather than the 'overflow-style' property as proposed
680 in the [[CSS3GCPM]] draft
681 (which also matches the [[CSS3-MARQUEE]] proposal).
682 or the 'continue' property as described here.
683 </p>
685 <h2 id="fragment-overflow">Fragment overflow</h2>
687 This section introduces and defines the meaning of
688 the ''continue/fragments'' value of the 'continue' property.
690 <p>
691 When the computed value of 'continue' for an element is ''continue/fragments'',
692 and implementations would otherwise have created a box for the element,
693 then implementations must create a sequence of <dfn>fragment box</dfn>es
694 for that element.
695 (It is possible for an element with ''continue: fragments''
696 to generate only one <a>fragment box</a>.
697 However, if an element's computed 'continue' is not ''continue/fragments'',
698 then its box is not a <a>fragment box</a>.)
699 Every <a>fragment box</a> is a fragmentation container,
700 and any overflow
701 that would cause that fragmentation container to fragment
702 causes another <a>fragment box</a> created as a next sibling
703 of the previous one.
704 <span class="issue">Or is it as though it's a next sibling of
705 the element? Need to figure out exactly how this interacts with
706 other box-level fixup.</span>
707 Additionally, if the <a>fragment box</a> is also
708 a multi-column box (as defined in [[!CSS3COL]]
709 <span class="issue">though it defines <i>multi-column element</i></span>)
710 any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
711 instead is flown into an additional fragment box.
712 However, fragment boxes may themselves be broken
713 (due to fragmentation in a fragmentation context outside of them,
714 such as pages, columns, or other fragment boxes);
715 such breaking leads to fragments of the same fragment box
716 rather than multiple fragment boxes.
717 (This matters because fragment boxes may be styled by their index;
718 such breaking leads to multiple fragments of a fragment box
719 with a single index.
720 This design choice is so that
721 breaking a fragment box across pages does not break
722 the association of indices to particular pieces of content.)
723 <span class="issue">Should a forced break that breaks to
724 an outer fragmentation context cause a new fragment of a single
725 fragment box or a new fragment box?</span>
726 <span class="issue">Should we find a term other than
727 <a>fragment box</a> here to make this a little less confusing?</span>
728 </p>
730 <p class="issue">
731 What if we want to be able to style the pieces of an element
732 split within another type of fragmentation context?
733 These rules prevent ever using ''::nth-fragment()'' for that,
734 despite that the name seems the most logical name for such a feature.
735 </p>
737 <div class="example">
738 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
739 <title>Breaking content into
740 equal-sized cards</title>
741 <style>
742 .in-cards {
743 continue: fragments;
745 width: 13em;
746 height: 8em;
748 padding: 4px;
749 border: medium solid blue;
750 margin: 6px;
752 font: medium/1.3 Times New
753 Roman, Times, serif;
754 }
755 </style>
756 <div class="in-cards">
757 In this example, the text in the div
758 is broken into a series of cards.
759 These cards all have the same style.
760 The presence of enough content to
761 overflow one of the cards causes
762 another one to be created. The second
763 card is created just like it's the
764 next sibling of the first.
765 </div></pre></td><td>
766 <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>
767 <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>
768 </td></tr></table>
769 </div>
771 <p class="issue">
772 We should specify that ''continue: fragments'' does not apply
773 to at least some table parts,
774 and perhaps other elements as well.
775 We need to determine exactly which ones.
776 </p>
778 <p class="issue">
779 This specification needs to say which type of
780 fragmentation context is created
781 so that it's clear which values of the 'break-*' properties
782 cause breaks within this context.
783 We probably want ''break-*: region'' to apply.
784 </p>
786 <p class="issue">
787 This specification needs a processing model
788 that will apply in cases where the layout containing the
789 fragments has characteristics that use the intrinsic size of the fragments
790 to change the amount of space available for them,
791 such as [[CSS3-GRID-LAYOUT]].
792 There has already been some work on such a processing model
793 in [[CSS3-REGIONS]],
794 and the work done on a model there,
795 and the editors of that specification,
796 should inform what happens in this specification.
797 </p>
799 <h3 id="fragment-styling">Fragment styling</h3>
801 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
803 <p>
804 The <dfn selector>::nth-fragment()</dfn> pseudo-element
805 is a pseudo-element
806 that describes some of the <a>fragment box</a>es generated by an element.
807 The argument to the pseudo-element takes the same syntax
808 as the argument to the :nth-child() pseudo-class
809 defined in [[!SELECT]], and has the same meaning
810 except that the number is relative to
811 <a>fragment box</a>es generated by the element
812 instead of siblings of the element.
813 </p>
815 <p class="note">
816 Selectors that allow addressing fragments
817 by counting from the end rather than the start
818 are intentionally not provided.
819 Such selectors would interfere with determining
820 the number of fragments.
821 </p>
823 <p class="issue">
824 Depending on future discussions,
825 this ''::nth-fragment(<var>an+b</var>)'' syntax
826 may be replaced with
827 the new ''::fragment:nth(<var>an+b</var>)'' syntax.
828 </p>
830 <h4 id="style-of-fragments">Styling of fragments</h4>
832 <p class="issue">
833 Should this apply to continue:fragments only,
834 or also to continue:paginate?
835 (If it applies,
836 then stricter property restrictions would be needed
837 for continue:paginate.)
838 </p>
840 <p>
841 In the absence of rules with ''::nth-fragment()'' pseudo-elements,
842 the computed style for each <a>fragment box</a>
843 is the computed style for the element
844 for which the <a>fragment box</a> was created.
845 However, the style for a <a>fragment box</a> is also influenced
846 by rules whose selector's <a>subject</a> [[!SELECT]]
847 has an ''::nth-fragment()'' pseudo-element,
848 if the 1-based number of the <a>fragment box</a> matches
849 that ''::nth-fragment()'' pseudo-element
850 and the selector (excluding the ''::nth-fragment()'' pseudo-element)
851 matches the element generating the fragments.
852 </p>
854 <p>
855 When determining the style of the <a>fragment box</a>,
856 these rules that match the fragment pseudo-element
857 cascade together with the rules that match the element,
858 with the fragment pseudo-element adding the specificity
859 of a pseudo-class to the specificity calculation.
860 <span class="issue">Does this need to be specified in
861 the cascading module as well?</span>
862 </p>
864 <div class="example">
865 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
866 <style>
867 .bouncy-columns {
868 continue: fragments;
869 width: 6em;
870 height: 10em;
871 float: left;
872 margin: 1em;
873 font: medium/1.25 Times New
874 Roman, Times, serif;
875 }
876 .bouncy-columns::nth-fragment(1) {
877 background: aqua; color: black;
878 transform: rotate(-3deg);
879 }
880 .bouncy-columns::nth-fragment(2) {
881 background: yellow; color: black;
882 transform: rotate(3deg);
883 }
884 </style>
885 <div class="bouncy-columns">
886 <i>...</i>
887 </div></pre></td><td>
888 <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>
889 <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>
890 <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>
891 </td></tr></table>
892 </div>
894 <p>
895 Styling an ''::nth-fragment()'' pseudo-element with the 'continue'
896 property does take effect;
897 if a <a>fragment box</a> has a
898 computed value of 'continue' other than ''fragments''
899 then that fragment box is the last fragment.
900 However, overriding 'continue' on the first fragment
901 does not cause the <a>fragment box</a> not to exist;
902 whether there are fragment boxes at all is determined by
903 the computed value of overflow for the element.
904 </p>
906 <p>
907 Styling an ''::nth-fragment()'' pseudo-element with the 'content'
908 property has no effect;
909 the computed value of 'content' for the fragment box
910 remains the same as the computed value of content for the element.
911 </p>
913 <p>
914 Specifying ''display: none'' for a <a>fragment box</a> causes
915 the fragment box with that index not to be generated.
916 However, in terms of the indices
917 used for matching ''::nth-fragment()'' pseudo-elements
918 of later fragment boxes,
919 it still counts as though it was generated.
920 However, since it is not generated, it does not contain any content.
921 </p>
923 <p>
924 Specifying other values of 'display', 'position',
925 or 'float' is permitted, but is not allowed to change
926 the computed value of 'display-inside'.
927 (Since 'continue' only
928 applies to block containers, flex containers, and grid containers
929 the computed value of 'display-inside' is always
930 ''display-inside/block'', ''display-inside/flex'', or
931 ''display-inside/grid''.
932 <span class="issue">Need to specify exactly how this works,
933 but it depends on
934 having 'display-inside' and 'display-outside' specified.</span>
935 </p>
937 <p>
938 To match the model for other pseudo-elements
939 where the pseudo-elements live inside their corresponding element,
940 declarations in ''::nth-fragment()'' pseudo-elements override
941 declarations in rules without the pseudo-element.
942 The relative priority within such declarations is determined
943 by normal cascading order (see [[!CSS21]]).
944 </p>
946 <p>
947 Styles specified on ''::nth-fragment()'' pseudo-elements
948 do affect inheritance to content within the <a>fragment box</a>.
949 In other words, the content within the <a>fragment box</a> must
950 inherit from the fragment box's style (i.e., the pseudo-element style)
951 rather than directly from the element.
952 This means that elements split between fragment boxes may
953 have different styles for different parts of the element.
954 </p>
956 <p class="issue">
957 This inheritance rule allows specifying styles indirectly
958 (by using explicit ''inherit'' or using default inheritance
959 on properties that don't apply to ''::first-letter'')
960 that can't be specified directly
961 (based on the rules in the next section).
962 This is a problem.
963 The restrictions that apply to styling inside fragments
964 should also apply to inheritance from fragments.
965 </p>
967 <div class="example">
968 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
969 <style>
970 .article {
971 continue: fragments;
972 }
973 .article::nth-fragment(1) {
974 font-size: 1.5em;
975 margin-bottom: 1em;
976 height: 4em;
977 }
978 .article::nth-fragment(2) {
979 margin-left: 5em;
980 margin-right: 2em;
981 }
982 </style>
983 <div class="article">
984 The <code>font-size</code> property<i>...</i>
985 </div></pre></td><td>
986 <div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
987 <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>
988 </td></tr></table>
989 </div>
991 <h4 id="style-in-fragments">Styling inside fragments</h4>
993 <p class="issue">
994 Should this apply to continue:fragments only,
995 or also to continue:paginate?
996 </p>
998 <p>
999 The ''::nth-fragment()'' pseudo-element
1000 can also be used to style
1001 content inside of a <a>fragment box</a>.
1002 Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
1003 the ''::nth-fragment()'' pseudo-element can be applied
1004 to parts of the selector other than the subject:
1005 in particular, it can match ancestors of the subject.
1006 However, the only CSS properties applied
1007 by rules with such selectors
1008 are those that apply
1009 to the ''::first-letter'' pseudo-element.
1010 </p>
1012 <p>
1013 To be more precise,
1014 when a rule's selector has ''::nth-fragment()'' pseudo-elements
1015 attached to parts of the selector other than the subject,
1016 the declarations in that rule apply to
1017 a fragment (or pseudo-element thereof) when:
1018 </p>
1019 <ol>
1020 <li>
1021 the declarations are for properties that apply to the
1022 ''::first-letter'' pseudo-element,
1023 </li>
1024 <li>
1025 the declarations would apply to
1026 that fragment (or pseudo-element thereof)
1027 had those ''::nth-fragment()'' pseudo-elements been removed,
1028 with a particular association between
1029 each sequence of simple selectors and the element it matched,
1030 and
1031 </li>
1032 <li>
1033 for each removed ''::nth-fragment()'' pseudo-element,
1034 the fragment lives within a <a>fragment box</a>
1035 of the element associated in that association
1036 with the selector that the pseudo-element was attached to,
1037 and whose index matches the pseudo-element.
1038 </li>
1039 </ol>
1041 <div class="example">
1042 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
1043 <style>
1044 .dark-columns {
1045 continue: fragments;
1046 width: 6em;
1047 height: 10em;
1048 float: left;
1049 margin-right: 1em;
1050 font: medium/1.25 Times New
1051 Roman, Times, serif;
1052 }
1053 .dark-columns::nth-fragment(1) {
1054 background: aqua; color: black;
1055 }
1056 .dark-columns::nth-fragment(1) :link {
1057 color: blue;
1058 }
1059 .dark-columns::nth-fragment(1) :visited {
1060 color: purple;
1061 }
1062 .dark-columns::nth-fragment(2) {
1063 background: navy; color: white;
1064 }
1065 .dark-columns::nth-fragment(2) :link {
1066 color: aqua;
1067 }
1068 .dark-columns::nth-fragment(2) :visited {
1069 color: fuchsia;
1070 }
1071 </style>
1072 <div class="dark-columns">
1073 <i>...</i>
1074 </div></pre></td><td>
1075 <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>
1076 <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>
1077 </td></tr></table>
1078 </div>
1081 <h3 id="max-lines">The 'max-lines' property</h3>
1083 <p>
1084 Authors may wish to style the opening lines of an element
1085 with different styles
1086 by putting those opening lines in a separate fragment.
1087 However, since it may be difficult to predict the exact height
1088 occupied by those lines
1089 in order to restrict the first fragment to that height,
1090 this specification introduces a 'max-lines' property
1091 that forces a fragment to break
1092 after a specified number of lines.
1093 This forces a break after the given number of lines
1094 contained within the element or its descendants,
1095 as long as those lines are in the same block formatting context.
1096 </p>
1098 <pre class=propdef>
1099 Name: max-lines
1100 Value: ''none'' | ''<integer>''
1101 Initial: ''none''
1102 Applies to: fragment boxes
1103 Inherited: no
1104 Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
1105 Percentages: N/A
1106 Media: visual
1107 Computed value: specified value
1108 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
1109 </pre>
1111 <dl dfn-for="max-lines" dfn-type="value">
1112 <dt><dfn>none</dfn>
1113 <dd>
1114 <p>
1115 Breaks occur only as specified elsewhere.
1116 </p>
1117 </dd>
1119 <dt><dfn><<integer>></dfn>
1120 <dd>
1121 <p>
1122 In addition to any breaks specified elsewhere,
1123 a break is forced before any line that would exceed
1124 the given number of lines
1125 being placed inside the element
1126 (excluding lines that are in
1127 a different block formatting context from
1128 the block formatting context to which
1129 an unstyled child of the element would belong).
1130 </p>
1132 <p class="issue">
1133 If there are multiple boundaries between this line
1134 and the previous, where exactly (in terms of element
1135 boundaries) is the break forced?
1136 </p>
1138 <p>
1139 Only positive integers are accepted.
1140 Zero or negative integers are a parse error.
1141 </p>
1142 </dd>
1143 </dl>
1145 <p class="issue">Should this apply to fragment overflow only, or also
1146 to pagination?
1147 Given what we're doing with the continue property,
1148 it should actually apply to any fragmentainer.</p>
1150 Issue: having max-lines do nothing on regular elements is not ideal.
1151 When applied to non fragmentainers,
1152 it should probably cause 'continue' to compute to ''continue/discard''
1153 so that you only need to reach for one property rather than 2 to get
1154 that effect.
1156 <div class="example">
1157 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
1158 <style>
1159 .article {
1160 continue: fragments;
1161 }
1162 .article::first-letter {
1163 font-size: 2em;
1164 line-height: 0.9;
1165 }
1166 .article::nth-fragment(1) {
1167 font-size: 1.5em;
1168 max-lines: 3;
1169 }
1170 .article::nth-fragment(2) {
1171 column-count: 2;
1172 }
1173 </style>
1174 <div class="article">
1175 <i>...</i>
1176 </div></pre></td><td>
1177 <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>
1178 <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>
1179 <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>
1180 </td></tr></table>
1181 </div>
1183 <h2 id="static-media">Overflow in static media</h2>
1185 <p class="issue">
1186 This specification should define useful behavior
1187 for all values of 'overflow' and 'continue'
1188 in static media (such as print).
1189 Current implementation behavior is quite poor and
1190 produces unexpected results when authors have not considered
1191 what will happen when
1192 the content they produce for interactive media
1193 is printed.
1194 </p>
1196 <h2 class=no-num id="acknowledgments">
1197 Acknowledgments</h2>
1199 <p>
1200 Thanks especially to the feedback from
1201 Rossen Atanassov,
1202 Bert Bos,
1203 Tantek Ãelik,
1204 John Daggett,
1205 fantasai,
1206 Daniel Glazman,
1207 Vincent Hardy,
1208 Håkon Wium Lie,
1209 Peter Linss,
1210 Robert O'Callahan,
1211 Florian Rivoal,
1212 Alan Stearns,
1213 Steve Zilles,
1214 and all the rest of the
1215 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
1216 </p>