Mon, 25 Mar 2013 16:30:14 -0700
[css3-overflow] Acknowledge roc for pointing out that display-inside was the thing that needed to be kept constant across fragments.
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>CSS Overflow Module Level 3</title>
6 <link rel=contents href="#contents">
7 <link rel=index href="#index">
8 <link rel="stylesheet" type="text/css" href="../default.css">
9 <link rel="stylesheet" type="text/css"
10 href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
11 <style>
12 table.source-demo-pair {
13 width: 100%;
14 }
16 .in-cards-demo {
17 width: 13em;
18 height: 8em;
20 padding: 4px;
21 border: medium solid blue;
22 margin: 6px;
24 font: medium/1.3 Times New Roman, Times, serif;
25 white-space: nowrap;
26 }
28 .bouncy-columns-demo {
29 width: 6em;
30 height: 10em;
31 float: left;
32 margin: 1em;
33 font: medium/1.25 Times New Roman, Times, serif;
34 white-space: nowrap;
35 }
36 .bouncy-columns-demo.one {
37 background: aqua; color: black;
38 transform: rotate(-3deg);
39 }
40 .bouncy-columns-demo.two {
41 background: yellow; color: black;
42 transform: rotate(3deg);
43 }
45 .article-font-inherit-demo {
46 font: 1em/1.25 Times New Roman, Times, serif;
47 white-space: nowrap;
48 }
49 .article-font-inherit-demo.one {
50 width: 12em;
51 font-size: 1.5em;
52 margin-bottom: 1em;
53 height: 4em;
54 }
55 .article-font-inherit-demo.two {
56 width: 11em;
57 margin-left: 5em;
58 margin-right: 2em;
59 }
61 .dark-columns-demo {
62 width: 6em;
63 height: 10em;
64 float: left;
65 margin-right: 1em;
66 font: medium/1.25 Times New Roman, Times, serif;
67 white-space: nowrap;
68 }
69 .dark-columns-demo.one {
70 background: aqua; color: black;
71 }
72 .dark-columns-demo.one :link {
73 color: blue;
74 }
75 .dark-columns-demo.one :visited {
76 color: purple;
77 }
78 .dark-columns-demo.two {
79 background: navy; color: white;
80 }
81 .dark-columns-demo.two :link {
82 color: aqua;
83 }
84 .dark-columns-demo.two :visited {
85 color: fuchsia;
86 }
88 .article-max-lines-demo {
89 font: 1em/1.25 Times New Roman, Times, serif;
90 white-space: nowrap;
91 }
92 .article-max-lines-demo.one::first-letter {
93 font-size: 2em;
94 line-height: 0.9;
95 }
96 .article-max-lines-demo.one {
97 font-size: 1.5em;
98 width: 16em;
99 }
100 .article-max-lines-demo.two {
101 width: 11.5em;
102 float: left; margin-right: 1em;
103 }
104 .article-max-lines-demo.three {
105 width: 11.5em;
106 float: left;
107 }
108 </style>
109 </head>
111 <div class="head">
112 <!--logo-->
114 <h1>CSS Overflow Module Level 3</h1>
116 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
117 <dl>
118 <dt>This version:
119 <dd><a href="[VERSION]">[VERSION]</a>
121 <dt>Latest version:
122 <dd><a href="http://www.w3.org/TR/css3-overflow/">http://www.w3.org/TR/css3-overflow/</a>
124 <dt>Editor's draft:
125 <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
126 (<a href="https://dvcs.w3.org/hg/csswg/log/tip/[SHORTNAME]/Overview.src.html">change log</a>)
128 <dt>Previous version:
129 <dd>none
131 <dt>Editors:
132 <dd class="h-card vcard">
133 <a class="p-name fn u-url url" rel="author"
134 href="http://dbaron.org/">L. David Baron</a>,
135 <a class="p-org org" href="http://www.mozilla.org/">Mozilla</a>
137 <dt>Issue Tracking:</dt>
138 <dd>Maintained in document (only editor's draft is current)
140 <dt>Feedback:</dt>
141 <dd><a href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a> with subject line “<kbd>[[SHORTNAME]] <var>… message topic …</var></kbd>”
143 <dt>Test suite:
144 <dd>none yet
145 </dl>
147 <!--copyright-->
149 <hr title="Separator for header">
150 </div>
152 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
154 <p>
155 <a href="http://www.w3.org/TR/CSS/">CSS</a> is
156 a language for describing
157 the rendering of structured documents (such as HTML and XML)
158 on screen, on paper, in speech, etc.
159 This module contains the features of CSS
160 relating to new mechanisms of overflow handling in visual media (e.g., screen or paper).
161 In interactive media,
162 it describes features that allow the overflow
163 from a fixed size container
164 to be handled by pagination (displaying one page at a time).
165 It also describes features, applying to all visual media,
166 that allow the contents of an element
167 to be spread across multiple fragments,
168 allowing the contents to flow across multiple regions
169 or to have different styles for different fragments.
170 </p>
172 <h2 class="no-num no-toc" id="status">Status of this document</h2>
174 <!--status-->
176 <p>The following features are at risk: …
178 <h2 class="no-num no-toc" id="contents">
179 Table of contents</h2>
181 <!--toc-->
183 <h2 id="intro">
184 Introduction</h2>
186 <p>
187 In CSS Level 1 [[CSS1]], placing more content than would fit
188 inside an element with a specified size
189 was generally an authoring error.
190 Doing so caused the content to extend
191 outside the bounds of the element,
192 which would likely cause
193 that content to overlap with other elements.
194 </p>
196 <p>
197 CSS Level 2 [[CSS21]] introduced the 'overflow' property,
198 which allows authors to have overflow be handled by scrolling,
199 which means it is no longer an authoring error.
200 It also allows authors to specify
201 that overflow is handled by clipping,
202 which makes sense when the author's intent
203 is that the content not be shown.
204 </p>
206 <p>
207 However, scrolling is not the only way
208 to present large amounts of content,
209 and may even not be the optimal way.
210 After all, the codex replaced the scroll
211 as the common format for large written works
212 because of its advantages.
213 </p>
215 <p>
216 This specification introduces
217 a mechanism for Web pages to specify
218 that an element of a page should handle overflow
219 through pagination rather than through scrolling.
220 </p>
222 <p>
223 This specification also extends the concept of overflow
224 in another direction.
225 Instead of requiring that authors specify a single area
226 into which the content of an element must flow,
227 this specification allows authors to specify multiple fragments,
228 each with their own dimensions and styles,
229 so that the content of the element can flow from one to the next,
230 using as many as needed to place the content without overflowing.
231 </p>
233 <p>
234 In both of these cases, implementations must
235 break the content in the block-progression dimension.
236 Implementations must do this is described
237 in the CSS Fragmentation Module [[!CSS3-BREAK]].
238 </p>
240 <h2 id="overflow-properties">Overflow properties</h2>
242 <p>
243 The ''overflow-x'' property specifies
244 the handling of overflow in the horizontal direction
245 (i.e., overflow from the left and right sides of the box),
246 and the ''overflow-y'' property specifies the handling
247 of overflow in the vertical direction
248 (i.e., overflow from the top and bottom sides of the box)
249 </p>
251 <table class=propdef>
252 <tr>
253 <th>Name:
254 <td><dfn>overflow-x</dfn>, <dfn>overflow-y</dfn>
255 <tr>
256 <th><a href="#values">Value</a>:
257 <td>visible | hidden | scroll | auto | paged-x | paged-y | paged-x-controls | paged-y-controls | fragments
258 <tr>
259 <th>Initial:
260 <td>visible
261 <tr>
262 <th>Applies to:
263 <td>block containers [[!CSS21]] and flex containers [[!CSS3-FLEXBOX]]
264 <tr>
265 <th>Inherited:
266 <td>no
267 <tr>
268 <th>Percentages:
269 <td>N/A
270 <tr>
271 <th>Media:
272 <td>visual
273 <tr>
274 <th>Computed value:
275 <td>see below
276 <tr>
277 <th>Animatable:
278 <td>no
279 <tr>
280 <th>Canonical order:
281 <td><abbr title="follows order of property value definition">per grammar</abbr>
282 </table>
284 <p>
285 The 'overflow' property is a shorthand property
286 that sets the specified values of both 'overflow-x' and 'overflow-y'
287 to the value specified for 'overflow'.
288 </p>
290 <table class=propdef>
291 <tr>
292 <th>Name:
293 <td><dfn>overflow</dfn>
294 <tr>
295 <th><a href="#values">Value</a>:
296 <td>visible | hidden | scroll | auto | paged-x | paged-y | paged-x-controls | paged-y-controls | fragments
297 <tr>
298 <th>Initial:
299 <td>see individual properties
300 <tr>
301 <th>Applies to:
302 <td>block containers
303 <tr>
304 <th>Inherited:
305 <td>no
306 <tr>
307 <th>Percentages:
308 <td>N/A
309 <tr>
310 <th>Media:
311 <td>visual
312 <tr>
313 <th>Computed value:
314 <td>see individual properties
315 <tr>
316 <th>Animatable:
317 <td>no
318 <tr>
319 <th>Canonical order:
320 <td><abbr title="follows order of property value definition">per grammar</abbr>
321 </table>
323 <p>The values of these properties are:</p>
325 <dl>
326 <dt><dfn>visible</dfn>
327 <dd>
328 There is no special handling of overflow, that is, it
329 may be rendered outside the block container.
330 </dd>
331 <dt><dfn>hidden</dfn>
332 <dt><dfn>scroll</dfn>
333 <dt><dfn>auto</dfn>
334 <dd>
335 These values are collectively the <dfn>scrolling values</dfn>;
336 they are defined in the section on
337 <a href="#scrolling-overflow">scrolling and hidden overflow</a>.
338 </dd>
339 <dt><dfn>paged-x</dfn>
340 <dt><dfn>paged-y</dfn>
341 <dt><dfn>paged-x-controls</dfn>
342 <dt><dfn>paged-y-controls</dfn>
343 <dt><dfn>fragments</dfn>
344 <dd>
345 These values are collectively the <dfn>fragmenting values</dfn>;
346 they are defined in the sections on
347 <a href="#paginated-overflow">paginated overflow</a> and
348 <a href="#fragment-overflow">fragment overflow</a>.
349 </dd>
350 </dl>
352 <div id="overflow-computed-values">
353 <p>The computed values of 'overflow-x' and 'overflow-y'
354 are determined from the cascaded values [[!CSS3CASCADE]]
355 based on the following rules:</p>
357 <ol>
358 <li>
359 If one or both of the cascaded values are
360 <i>fragmenting values</i>, then:
361 <ol>
362 <li>
363 If one of the cascaded values is one of the
364 <i>fragmenting values</i>
365 and the other is not,
366 then the computed values are
367 the same as the cascaded values.
368 </li>
369 <li>
370 If both of the cascaded values are <i>fragmenting values</i>, then:
371 <ol>
372 <li>
373 for horizontal writing mode [[!CSS3-WRITING-MODES]],
374 the computed value for ''overflow-y'' is the cascaded value
375 and the computed value for ''overflow-x'' is ''hidden'', or
376 </li>
377 <li>
378 for vertical writing mode [[!CSS3-WRITING-MODES]],
379 the computed value for ''overflow-x'' is the cascaded value
380 and the computed value for ''overflow-y'' is ''hidden''.
381 </li>
382 </ol>
383 </li>
384 </ol>
385 </li>
386 <li>
387 Otherwise, if one cascaded values is
388 one of the <i>scrolling values</i>
389 and the other is ''visible'',
390 then computed values are the cascaded values
391 with ''visible'' changed to ''hidden''.
392 </li>
393 <li>
394 Otherwise, the computed values are as specified.
395 </li>
396 </ol>
397 </div>
399 <p class="issue">
400 Are all 4 of the ''paged-*'' values really needed?
401 </p>
403 <p>
404 When the <i>fragmenting values</i> are used,
405 the overflow from the fragments themselves
406 treats the fragmenting value as ''hidden''.
407 <span class="issue">Is this the right behavior?</span>
408 <span class="issue">Give example.</span>
409 </p>
411 <h2 id="scrolling-overflow">Scrolling and hidden overflow</h2>
413 <p class="issue">
414 Move material from [[CSS21]] and [[CSS3BOX]] here.
415 </p>
417 <h2 id="paginated-overflow">Paginated overflow</h2>
419 <p class="issue">overflow:paginate or overflow:pages (or paged-x, paged-y, paged-x-controls, paged-y-controls as [[CSS3GCPM]] has?)</p>
421 <p class="issue">Ability to display N pages at once
422 rather than just one page at once?</p>
424 <p class="issue">
425 The current implementation of paginated overflow uses
426 the 'overflow'/'overflow-x'/'overflow-y' properties
427 rather than the 'overflow-style' property as proposed
428 in the [[CSS3GCPM]] draft
429 (which also matches the [[CSS3-MARQUEE]] proposal).
430 We should probably switch away from 'overflow-style',
431 but that's not 100% clear.
432 </p>
434 <h2 id="fragment-overflow">Fragment overflow</h2>
436 <p>
437 This section introduces and defines the meaning of
438 the new ''fragments'' value of the 'overflow' property.
439 </p>
441 <p>
442 When the computed value of 'overflow' for an element is ''fragments'',
443 and implementations would otherwise have created a box for the element,
444 then implementations must create a sequence of <dfn>fragment box</dfn>es
445 for that element.
446 (It is possible for an element with ''overflow: fragments''
447 to generate only one <i>fragment box</i>.
448 However, if an element's computed 'overflow' is not ''fragments'',
449 then its box is not a <i>fragment box</i>.)
450 Every <i>fragment box</i> is a fragmentation container,
451 and any overflow
452 that would cause that fragmentation container to fragment
453 causes another <i>fragment box</i> created as a next sibling
454 of the previous one.
455 <span class="issue">Or is it as though it's a next sibling of
456 the element? Need to figure out exactly how this interacts with
457 other box-level fixup.</span>
458 Additionally, if the <i>fragment box</i> is also
459 a multi-column box (as defined in [[!CSS3COL]]
460 <span class="issue">though it defines <i>multi-column element</i></span>)
461 any content that would lead to the creation of <i>overflow columns</i> [[!CSS3COL]]
462 instead is flown into an additional fragment box.
463 However, fragment boxes may themselves be broken
464 (due to fragmentation in a fragmentation context outside of them,
465 such as pages, columns, or other fragment boxes);
466 such breaking leads to fragments of the same fragment box
467 rather than multiple fragment boxes.
468 (This matters because fragment boxes may be styled by their index;
469 such breaking leads to multiple fragments of a fragment box
470 with a single index.
471 This design choice is so that
472 breaking a fragment box across pages does not break
473 the association of indices to particular pieces of content.)
474 <span class="issue">Should a forced break that breaks to
475 an outer fragmentation context cause a new fragment of a single
476 fragment box or a new fragment box?</span>
477 <span class="issue">Should we find a term other than
478 <i>fragment box</i> here to make this a little less confusing?</span>
479 </p>
481 <p class="issue">
482 What if we want to be able to style the pieces of an element
483 split within another type of fragmentation context?
484 These rules prevent ever using ''::nth-fragment()'' for that,
485 despite that the name seems the most logical name for such a feature.
486 </p>
488 <div class="example">
489 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
490 <title>Breaking content into
491 equal-sized cards</title>
492 <style>
493 .in-cards {
494 overflow: fragments;
496 width: 13em;
497 height: 8em;
499 padding: 4px;
500 border: medium solid blue;
501 margin: 6px;
503 font: medium/1.3 Times New
504 Roman, Times, serif;
505 }
506 </style>
507 <div class="in-cards">
508 In this example, the text in the div
509 is broken into a series of cards.
510 These cards all have the same style.
511 The presence of enough content to
512 overflow one of the cards causes
513 another one to be created. The second
514 card is created just like it's the
515 next sibling of the first.
516 </div></pre></td><td>
517 <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>
518 <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>
519 </td></tr></table>
520 </div>
522 <p class="issue">
523 We should specify that ''overflow: fragments'' does not apply
524 to at least some table parts,
525 and perhaps other elements as well.
526 We need to determine exactly which ones.
527 </p>
529 <p class="issue">
530 This specification needs to say which type of
531 fragmentation context is created
532 so that it's clear which values of the 'break' property
533 cause breaks within this context.
534 We probably want ''break: regions'' to apply.
535 </p>
537 <p class="issue">
538 This specification needs a processing model
539 that will apply in cases where the layout containing the
540 fragments has characteristics that use the intrinsic size of the fragments
541 to change the amount of space available for them,
542 such as [[CSS3-GRID-LAYOUT]].
543 There has already been some work on such a processing model
544 in [[CSS3-REGIONS]],
545 and the work done on a model there,
546 and the editors of that specification,
547 should inform what happens in this specification.
548 </p>
550 <h3 id="fragment-styling">Fragment styling</h3>
552 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
554 <p>
555 The ::nth-fragment() pseudo-element is a pseudo-element
556 that describes some of the <i>fragment box</i>es generated by an element.
557 The argument to the pseudo-element takes the same syntax
558 as the argument to the :nth-child() pseudo-class
559 defined in [[!SELECT]], and has the same meaning
560 except that the number is relative to
561 <i>fragment box</i>es generated by the element
562 instead of siblings of the element.
563 </p>
565 <p class="note">
566 Selectors that allow addressing fragments
567 by counting from the end rather than the start
568 are intentionally not provided.
569 Such selectors would interfere with determining
570 the number of fragments.
571 </p>
573 <p class="issue">
574 Depending on future discussions,
575 this ''::nth-fragment(<var>an+b</var>)'' syntax
576 may be replaced with
577 the new ''::fragment:nth(<var>an+b</var>)'' syntax.
578 </p>
580 <h4 id="style-of-fragments">Styling of fragments</h4>
582 <p class="issue">
583 Should this apply to fragment overflow only,
584 or also to paginated overflow?
585 (If it applies,
586 then stricter property restrictions would be needed
587 for paginated overflow.)
588 </p>
590 <p>
591 In the absence of rules with ''::nth-fragment()'' pseudo-elements,
592 the computed style for each <i>fragment box</i>
593 is the computed style for the element
594 for which the <i>fragment box</i> was created.
595 However, the style for a <i>fragment box</i> is also influenced
596 by rules whose selector's <i>subject</i> [[!SELECT]]
597 has an ''::nth-fragment()'' pseudo-element,
598 if the 1-based number of the <i>fragment box</i> matches
599 that ''::nth-fragment()'' pseudo-element
600 and the selector (excluding the ''::nth-fragment()'' pseudo-element)
601 matches the element generating the fragments.
602 </p>
604 <p>
605 When determining the style of the <i>fragment box</i>,
606 these rules that match the fragment pseudo-element
607 cascade together with the rules that match the element,
608 with the fragment pseudo-element adding the specificity
609 of a pseudo-class to the specificity calculation.
610 <span class="issue">Does this need to be specified in
611 the cascading module as well?</span>
612 </p>
614 <div class="example">
615 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
616 <style>
617 .bouncy-columns {
618 overflow: fragments;
619 width: 6em;
620 height: 10em;
621 float: left;
622 margin: 1em;
623 font: medium/1.25 Times New
624 Roman, Times, serif;
625 }
626 .bouncy-columns::nth-fragment(1) {
627 background: aqua; color: black;
628 transform: rotate(-3deg);
629 }
630 .bouncy-columns::nth-fragment(2) {
631 background: yellow; color: black;
632 transform: rotate(3deg);
633 }
634 </style>
635 <div class="bouncy-columns">
636 <i>...</i>
637 </div></pre></td><td>
638 <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>
639 <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>
640 <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>
641 </td></tr></table>
642 </div>
644 <p>
645 Styling an ''::nth-fragment()'' pseudo-element with the 'overflow'
646 property does take effect;
647 if a <i>fragment box</i> has a
648 computed value of 'overflow' other than ''fragments''
649 then that fragment box is the last fragment.
650 However, overriding ''overflow'' on the first fragment
651 does not cause the <i>fragment box</i> not to exist;
652 whether there are fragment boxes at all is determined by
653 the computed value of overflow for the element.
654 <span class="issue">Need to reword this to refer to the
655 appropriate choice of ''overflow-x'' or ''overflow-y'',
656 and then point to rule about the handling of the other one
657 of ''overflow-x'' or ''overflow-y''.</span>
658 </p>
660 <p>
661 Styling an ''::nth-fragment()'' pseudo-element with the 'content'
662 property has no effect;
663 the computed value of 'content' for the fragment box
664 remains the same as the computed value of content for the element.
665 </p>
667 <p>
668 Specifying ''display: none'' for a <i>fragment box</i> causes
669 the fragment box with that index not to be generated.
670 However, in terms of the indices
671 used for matching ''::nth-fragment()'' pseudo-elements
672 of later fragment boxes,
673 it still counts as though it was generated.
674 However, since it is not generated, it does not contain any content.
675 </p>
677 <p>
678 Specifying other values of 'display', 'position',
679 or 'float' is permitted, but is not allowed to change
680 the computed value of 'display-inside'.
681 (Since 'overflow', 'overflow-x', and 'overflow-y' only
682 apply to block containers and flex containers,
683 the computed value of 'display-inside' is always
684 ''block'' or ''flex''.
685 <span class="issue">Need to specify exactly how this works,
686 but it depends on
687 having 'display-inside' and 'display-outside' specified.</span>
688 </p>
690 <p>
691 To match the model for other pseudo-elements
692 where the pseudo-elements live inside their corresponding element,
693 declarations in ''::nth-fragment()'' pseudo-elements override
694 declarations in rules without the pseudo-element.
695 The relative priority within such declarations is determined
696 by normal cascading order (see [[!CSS21]]).
697 </p>
699 <p>
700 Styles specified on ''::nth-fragment()'' pseudo-elements
701 do affect inheritance to content within the <i>fragment box</i>.
702 In other words, the content within the <i>fragment box</i> must
703 inherit from the fragment box's style (i.e., the pseudo-element style)
704 rather than directly from the element.
705 This means that elements split between fragment boxes may
706 have different styles for different parts of the element.
707 </p>
709 <p class="issue">
710 This inheritance rule allows specifying styles indirectly
711 (by using explicit ''inherit'' or using default inheritance
712 on properties that don't apply to '':first-letter'')
713 that can't be specified directly
714 (based on the rules in the next section).
715 This is a problem.
716 The restrictions that apply to styling inside fragments
717 should also apply to inheritance from fragments.
718 </p>
720 <div class="example">
721 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
722 <style>
723 .article {
724 overflow: fragments;
725 }
726 .article::nth-fragment(1) {
727 font-size: 1.5em;
728 margin-bottom: 1em;
729 height: 4em;
730 }
731 .article::nth-fragment(2) {
732 margin-left: 5em;
733 margin-right: 2em;
734 }
735 </style>
736 <div class="article">
737 The <code>font-size</code> property<i>...</i>
738 </div></pre></td><td>
739 <div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
740 <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>
741 </td></tr></table>
742 </div>
744 <h4 id="style-in-fragments">Styling inside fragments</h4>
746 <p class="issue">
747 Should this apply to fragment overflow only,
748 or also to paginated overflow,
749 or even to pagination across pages?
750 </p>
752 <p>
753 The ''::nth-fragment()'' pseudo-element
754 can also be used to style
755 content inside of a <i>fragment box</i>.
756 Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
757 the ''::nth-fragment()'' pseudo-element can be applied
758 to parts of the selector other than the subject:
759 in particular, it can match ancestors of the subject.
760 However, the only CSS properties applied
761 by rules with such selectors
762 are those that apply
763 to the ''::first-letter'' pseudo-element.
764 </p>
766 <p>
767 To be more precise,
768 when a rule's selector has ''::nth-fragment()'' pseudo-elements
769 attached to parts of the selector other than the subject,
770 the declarations in that rule apply to
771 a fragment (or pseudo-element thereof) when:
772 </p>
773 <ol>
774 <li>
775 the declarations are for properties that apply to the
776 ''::first-letter'' pseudo-element,
777 </li>
778 <li>
779 the declarations would apply to
780 that fragment (or pseudo-element thereof)
781 had those ''::nth-fragment()'' pseudo-elements been removed,
782 with a particular association between
783 each sequence of simple selectors and the element it matched,
784 and
785 </li>
786 <li>
787 for each removed ''::nth-fragment()'' pseudo-element,
788 the fragment lives within a <i>fragment box</i>
789 of the element associated in that association
790 with the selector that the pseudo-element was attached to,
791 and whose index matches the pseudo-element.
792 </li>
793 </ol>
795 <div class="example">
796 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
797 <style>
798 .dark-columns {
799 overflow: fragments;
800 width: 6em;
801 height: 10em;
802 float: left;
803 margin-right: 1em;
804 font: medium/1.25 Times New
805 Roman, Times, serif;
806 }
807 .dark-columns::nth-fragment(1) {
808 background: aqua; color: black;
809 }
810 .dark-columns::nth-fragment(1) :link {
811 color: blue;
812 }
813 .dark-columns::nth-fragment(1) :visited {
814 color: purple;
815 }
816 .dark-columns::nth-fragment(2) {
817 background: navy; color: white;
818 }
819 .dark-columns::nth-fragment(2) :link {
820 color: aqua;
821 }
822 .dark-columns::nth-fragment(2) :visited {
823 color: fuchsia;
824 }
825 </style>
826 <div class="dark-columns">
827 <i>...</i>
828 </div></pre></td><td>
829 <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>
830 <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>
831 </td></tr></table>
832 </div>
835 <h3 id="max-lines">The 'max-lines' property</h3>
837 <p>
838 Authors may wish to style the opening lines of an element
839 with different styles
840 by putting those opening lines in a separate fragment.
841 However, since it may be difficult to predict the exact height
842 occupied by those lines
843 in order to restrict the first fragment to that height,
844 this specification introduces a 'max-lines' property
845 that forces a fragment to break
846 after a specified number of lines.
847 This forces a break after the given number of lines
848 contained within the element or its descendants,
849 as long as those lines are in the same block formatting context.
850 </p>
852 <table class=propdef>
853 <tr>
854 <th>Name:
855 <td><dfn>max-lines</dfn>
856 <tr>
857 <th><a href="#values">Value</a>:
858 <td>none | <integer>
859 <tr>
860 <th>Initial:
861 <td>none
862 <tr>
863 <th>Applies to:
864 <td>fragment boxes
865 <tr>
866 <th>Inherited:
867 <td>no
868 <tr>
869 <th>Animatable:
870 <td>as <a href="http://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
871 <tr>
872 <th>Percentages:
873 <td>N/A
874 <tr>
875 <th>Media:
876 <td>visual
877 <tr>
878 <th>Computed value:
879 <td>specified value
880 <tr>
881 <th>Canonical order:
882 <td><abbr title="follows order of property value definition">per grammar</abbr>
883 </table>
885 <dl>
886 <dt>none
887 <dd>
888 <p>
889 Breaks occur only as specified elsewhere.
890 </p>
891 </dd>
893 <dt><integer>
894 <dd>
895 <p>
896 In addition to any breaks specified elsewhere,
897 a break is forced before any line that would exceed
898 the given number of lines
899 being placed inside the element
900 (excluding lines that are in
901 a different block formatting context from
902 the block formatting context to which
903 an unstyled child of the element would belong).
904 </p>
906 <p class="issue">
907 If there are multiple boundaries between this line
908 and the previous, where exactly (in terms of element
909 boundaries) is the break forced?
910 </p>
912 <p>
913 Only positive integers are accepted.
914 Zero or negative integers are a parse error.
915 </p>
916 </dd>
917 </dl>
919 <p class="issue">Should this apply to fragment overflow only, or also
920 to pagination?</p>
922 <div class="example">
923 <table class="source-demo-pair"><tr><td><pre><!DOCTYPE HTML>
924 <style>
925 .article {
926 overflow: fragments;
927 }
928 .article::first-letter {
929 font-size: 2em;
930 line-height: 0.9;
931 }
932 .article::nth-fragment(1) {
933 font-size: 1.5em;
934 max-lines: 3;
935 }
936 .article::nth-fragment(2) {
937 column-count: 2;
938 }
939 </style>
940 <div class="article">
941 <i>...</i>
942 </div></pre></td><td>
943 <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>
944 <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>
945 <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>
946 </td></tr></table>
947 </div>
949 <h2 id="static-media">Overflow in static media</h2>
951 <p class="issue">
952 This specification should define useful behavior
953 for all values of 'overflow'
954 in static media (such as print).
955 Current implementation behavior is quite poor and
956 produces unexpected results when authors have not considered
957 what will happen when
958 the content they produce for interactive media
959 is printed.
960 </p>
962 <h2 id="conformance">
963 Conformance</h2>
965 <h3 id="placement">
966 Module interactions</h3>
968 <p>This module extends the 'overflow'
969 feature defined in [[CSS21]] section 11.1.1. It defines additional
970 overflow handling mechanisms that implementations must implement as
971 described in this module in order to conform to this module.</p>
973 <p>No properties in this module apply to the <code>::first-line</code> or
974 <code>::first-letter</code> pseudo-elements.</p>
976 <h3 id="values">
977 Values</h3>
979 <p>This specification follows the
980 <a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property
981 definition conventions</a> from [[!CSS21]]. Value types not defined in
982 this specification are defined in CSS Level 2 Revision 1 [[!CSS21]].
983 Other CSS modules may expand the definitions of these value types: for
984 example [[CSS3COLOR]], when combined with this module, expands the
985 definition of the <color> value type as used in this specification.</p>
987 <p>In addition to the property-specific values listed in their definitions,
988 all properties defined in this specification also accept the
989 <a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a>
990 keyword as their property value. For readability it has not been repeated
991 explicitly.
994 <h3 id="conventions">
995 Document conventions</h3>
997 <p>Conformance requirements are expressed with a combination of
998 descriptive assertions and RFC 2119 terminology. The key words “MUST”,
999 “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
1000 “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
1001 document are to be interpreted as described in RFC 2119.
1002 However, for readability, these words do not appear in all uppercase
1003 letters in this specification.
1005 <p>All of the text of this specification is normative except sections
1006 explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p>
1008 <p>Examples in this specification are introduced with the words “for example”
1009 or are set apart from the normative text with <code>class="example"</code>,
1010 like this:
1012 <div class="example">
1013 <p>This is an example of an informative example.</p>
1014 </div>
1016 <p>Informative notes begin with the word “Note” and are set apart from the
1017 normative text with <code>class="note"</code>, like this:
1019 <p class="note">Note, this is an informative note.</p>
1021 <h3 id="conformance-classes">
1022 Conformance classes</h3>
1024 <p>Conformance to CSS Overflow Module Level 3
1025 is defined for three conformance classes:
1026 <dl>
1027 <dt><dfn title="style sheet!!as conformance class">style sheet</dfn>
1028 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS
1029 style sheet</a>.
1030 <dt><dfn>renderer</dfn></dt>
1031 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
1032 that interprets the semantics of a style sheet and renders
1033 documents that use them.
1034 <dt><dfn id="authoring-tool">authoring tool</dfn></dt>
1035 <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a>
1036 that writes a style sheet.
1037 </dl>
1039 <p>A style sheet is conformant to CSS Overflow Module Level 3
1040 if all of its statements that use syntax defined in this module are valid
1041 according to the generic CSS grammar and the individual grammars of each
1042 feature defined in this module.
1044 <p>A renderer is conformant to CSS Overflow Module Level 3
1045 if, in addition to interpreting the style sheet as defined by the
1046 appropriate specifications, it supports all the features defined
1047 by CSS Overflow Module Level 3 by parsing them correctly
1048 and rendering the document accordingly. However, the inability of a
1049 UA to correctly render a document due to limitations of the device
1050 does not make the UA non-conformant. (For example, a UA is not
1051 required to render color on a monochrome monitor.)
1053 <p>An authoring tool is conformant to CSS Overflow Module Level 3
1054 if it writes style sheets that are syntactically correct according to the
1055 generic CSS grammar and the individual grammars of each feature in
1056 this module, and meet all other conformance requirements of style sheets
1057 as described in this module.
1059 <h3 id="partial">
1060 Partial implementations</h3>
1062 <p>So that authors can exploit the forward-compatible parsing rules to
1063 assign fallback values, CSS renderers <strong>must</strong>
1064 treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore
1065 as appropriate</a>) any at-rules, properties, property values, keywords,
1066 and other syntactic constructs for which they have no usable level of
1067 support. In particular, user agents <strong>must not</strong> selectively
1068 ignore unsupported component values and honor supported values in a single
1069 multi-value property declaration: if any value is considered invalid
1070 (as unsupported values must be), CSS requires that the entire declaration
1071 be ignored.</p>
1073 <h3 id="experimental">
1074 Experimental implementations</h3>
1076 <p>To avoid clashes with future CSS features, the CSS2.1 specification
1077 reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed
1078 syntax</a> for proprietary and experimental extensions to CSS.
1080 <p>Prior to a specification reaching the Candidate Recommendation stage
1081 in the W3C process, all implementations of a CSS feature are considered
1082 experimental. The CSS Working Group recommends that implementations
1083 use a vendor-prefixed syntax for such features, including those in
1084 W3C Working Drafts. This avoids incompatibilities with future changes
1085 in the draft.
1086 </p>
1088 <h3 id="testing">
1089 Non-experimental implementations</h3>
1091 <p>Once a specification reaches the Candidate Recommendation stage,
1092 non-experimental implementations are possible, and implementors should
1093 release an unprefixed implementation of any CR-level feature they
1094 can demonstrate to be correctly implemented according to spec.
1096 <p>To establish and maintain the interoperability of CSS across
1097 implementations, the CSS Working Group requests that non-experimental
1098 CSS renderers submit an implementation report (and, if necessary, the
1099 testcases used for that implementation report) to the W3C before
1100 releasing an unprefixed implementation of any CSS features. Testcases
1101 submitted to W3C are subject to review and correction by the CSS
1102 Working Group.
1104 <p>Further information on submitting testcases and implementation reports
1105 can be found from on the CSS Working Group's website at
1106 <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
1107 Questions should be directed to the
1108 <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a>
1109 mailing list.
1111 <h3 id="cr-exit-criteria">
1112 CR exit criteria</h3>
1114 <p class=issue>[Change or remove the following CR exit criteria if
1115 the spec is not a module, but, e.g., a Note or a profile. This text was <a
1116 href="http://www.w3.org/Style/CSS/Tracker/actions/44"> decided on 2008-06-04.</a>]</p>
1118 <p>
1119 For this specification to be advanced to Proposed Recommendation,
1120 there must be at least two independent, interoperable implementations
1121 of each feature. Each feature may be implemented by a different set of
1122 products, there is no requirement that all features be implemented by
1123 a single product. For the purposes of this criterion, we define the
1124 following terms:
1126 <dl>
1127 <dt>independent <dd>each implementation must be developed by a
1128 different party and cannot share, reuse, or derive from code
1129 used by another qualifying implementation. Sections of code that
1130 have no bearing on the implementation of this specification are
1131 exempt from this requirement.
1133 <dt>interoperable <dd>passing the respective test case(s) in the
1134 official CSS test suite, or, if the implementation is not a Web
1135 browser, an equivalent test. Every relevant test in the test
1136 suite should have an equivalent test created if such a user
1137 agent (UA) is to be used to claim interoperability. In addition
1138 if such a UA is to be used to claim interoperability, then there
1139 must one or more additional UAs which can also pass those
1140 equivalent tests in the same way for the purpose of
1141 interoperability. The equivalent tests must be made publicly
1142 available for the purposes of peer review.
1144 <dt>implementation <dd>a user agent which:
1146 <ol class=inline>
1147 <li>implements the specification.
1149 <li>is available to the general public. The implementation may
1150 be a shipping product or other publicly available version
1151 (i.e., beta version, preview release, or “nightly build”).
1152 Non-shipping product releases must have implemented the
1153 feature(s) for a period of at least one month in order to
1154 demonstrate stability.
1156 <li>is not experimental (i.e., a version specifically designed
1157 to pass the test suite and is not intended for normal usage
1158 going forward).
1159 </ol>
1160 </dl>
1162 <p>The specification will remain Candidate Recommendation for at least
1163 six months.
1165 <h2 class=no-num id="acknowledgments">
1166 Acknowledgments</h2>
1168 <p>
1169 Thanks especially to the feedback from
1170 Rossen Atanassov,
1171 Bert Bos,
1172 Tantek Çelik,
1173 John Daggett,
1174 fantasai,
1175 Daniel Glazman,
1176 Vincent Hardy,
1177 Håkon Wium Lie,
1178 Peter Linss,
1179 Robert O'Callahan,
1180 Florian Rivoal,
1181 Alan Stearns,
1182 Steve Zilles,
1183 and all the rest of the
1184 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
1185 </p>
1187 <h2 class=no-num id="references">
1188 References</h2>
1190 <h3 class="no-num" id="normative-references">
1191 Normative references</h3>
1192 <!--normative-->
1194 <h3 class="no-num" id="other-references">
1195 Other references</h3>
1196 <!--informative-->
1198 <h2 class="no-num" id="index">
1199 Index</h2>
1200 <!--index-->
1202 <h2 class="no-num" id="property-index">
1203 Property index</h2>
1204 <!-- properties -->
1206 </body>
1207 </html>
1208 <!-- Keep this comment at the end of the file
1209 Local variables:
1210 mode: sgml
1211 sgml-declaration:"~/SGML/HTML4.decl"
1212 sgml-default-doctype-name:"html"
1213 sgml-minimize-attributes:t
1214 sgml-nofill-elements:("pre" "style" "br")
1215 sgml-live-element-indicator:t
1216 sgml-omittag:nil
1217 sgml-shorttag:nil
1218 sgml-namecase-general:t
1219 sgml-general-insert-case:lower
1220 sgml-always-quote-attributes:t
1221 sgml-indent-step:nil
1222 sgml-indent-data:t
1223 sgml-parent-document:nil
1224 sgml-exposed-tags:nil
1225 sgml-local-catalogs:nil
1226 sgml-local-ecat-files:nil
1227 End:
1228 -->