css-overflow/Overview.bs

Sun, 08 Feb 2015 17:06:34 +1100

author
L. David Baron <[email protected]>
date
Sun, 08 Feb 2015 17:06:34 +1100
changeset 15180
de66068e2396
parent 15125
f89d93413b7a
child 15181
9174c05261f3
permissions
-rw-r--r--

[css-overflow] Auto-link keywords in propdefs.

     1 <h1>CSS Overflow Module Level 3</h1>
     2 <pre class="metadata">
     3 Status: ED
     4 ED: http://dev.w3.org/csswg/css-overflow/
     5 Shortname: css-overflow
     6 Group: csswg
     7 Level: 1
     8 TR: http://www.w3.org/TR/css-overflow-3/
     9 Previous version: http://www.w3.org/TR/2013/WD-css-overflow-3-20130418/
    10 Editor: L. David Baron, Mozilla, http://dbaron.org/
    11 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.
    12 Status Text: The following features are at risk: &hellip;
    13 !Change Log: <a href="https://hg.csswg.org/drafts/log/tip/css-overflow/Overview.bs">from 27 January 2015 to the present</a>
    14 !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>
    15 !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>
    16 </pre>
    17 <!-- FIXME: Regressions from bikeshed conversion: -->
    18 <!-- - Value lines in propdef tables no longer link to #values. -->
    19 <!-- - no longer says "Test suite: none yet" -->
    20 <!-- - Abstract has the most introductory sentence last -->
    21 <pre class="link-defaults">
    22 spec:css-transforms-1; type:property; text:transform-style
    23 </pre>
    24 <!-- FIXME: the break-* link doesn't actually work! -->
    25 <pre class="anchors">
    26 url: http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#the-overflow-style; type: property; text: overflow-style;
    27 url: http://dev.w3.org/csswg/css-break/#breaking-controls; type: property; text: break-*;
    28 url: http://dev.w3.org/csswg/css-multicol/#overflow-columns; type: dfn; text: overflow columns;
    29 url: http://dev.w3.org/csswg/selectors-3/#subject; type: dfn; text: subject;
    30 </pre>
    31 	<style>
    32 		table.source-demo-pair {
    33 			width: 100%;
    34 		}
    36 		.in-cards-demo {
    37 			width: 13em;
    38 			height: 8em;
    40 			padding: 4px;
    41 			border: medium solid blue;
    42 			margin: 6px;
    44 			font: medium/1.3 Times New Roman, Times, serif;
    45 			white-space: nowrap;
    46 		}
    48 		.bouncy-columns-demo {
    49 			width: 6em;
    50 			height: 10em;
    51 			float: left;
    52 			margin: 1em;
    53 			font: medium/1.25 Times New Roman, Times, serif;
    54 			white-space: nowrap;
    55 		}
    56 		.bouncy-columns-demo.one {
    57 			background: aqua; color: black;
    58 			transform: rotate(-3deg);
    59 		}
    60 		.bouncy-columns-demo.two {
    61 			background: yellow; color: black;
    62 			transform: rotate(3deg);
    63 		}
    65 		.article-font-inherit-demo {
    66 			font: 1em/1.25 Times New Roman, Times, serif;
    67 			white-space: nowrap;
    68 		}
    69 		.article-font-inherit-demo.one {
    70 			width: 12em;
    71 			font-size: 1.5em;
    72 			margin-bottom: 1em;
    73 			height: 4em;
    74 		}
    75 		.article-font-inherit-demo.two {
    76 			width: 11em;
    77 			margin-left: 5em;
    78 			margin-right: 2em;
    79 		}
    81 		.dark-columns-demo {
    82 			width: 6em;
    83 			height: 10em;
    84 			float: left;
    85 			margin-right: 1em;
    86 			font: medium/1.25 Times New Roman, Times, serif;
    87 			white-space: nowrap;
    88 		}
    89 		.dark-columns-demo.one {
    90 			background: aqua; color: black;
    91 		}
    92 		.dark-columns-demo.one :link {
    93 			color: blue;
    94 		}
    95 		.dark-columns-demo.one :visited {
    96 			color: purple;
    97 		}
    98 		.dark-columns-demo.two {
    99 			background: navy; color: white;
   100 		}
   101 		.dark-columns-demo.two :link {
   102 			color: aqua;
   103 		}
   104 		.dark-columns-demo.two :visited {
   105 			color: fuchsia;
   106 		}
   108 		.article-max-lines-demo {
   109 			font: 1em/1.25 Times New Roman, Times, serif;
   110 			white-space: nowrap;
   111 		}
   112 		.article-max-lines-demo.one::first-letter {
   113 			font-size: 2em;
   114 			line-height: 0.9;
   115 		}
   116 		.article-max-lines-demo.one {
   117 			font-size: 1.5em;
   118 			width: 16em;
   119 		}
   120 		.article-max-lines-demo.two {
   121 			width: 11.5em;
   122 			float: left; margin-right: 1em;
   123 		}
   124 		.article-max-lines-demo.three {
   125 			width: 11.5em;
   126 			float: left;
   127 		}
   128 	</style>
   130 	<p>
   131 	</p>
   133 <h2 id="intro">
   134 Introduction</h2>
   136 	<p>
   137 		In CSS Level 1 [[CSS1]], placing more content than would fit
   138 		inside an element with a specified size
   139 		was generally an authoring error.
   140 		Doing so caused the content to extend
   141 		outside the bounds of the element,
   142 		which would likely cause
   143 		that content to overlap with other elements.
   144 	</p>
   146 	<p>
   147 		CSS Level 2 [[CSS21]] introduced the 'overflow' property,
   148 		which allows authors to have overflow be handled by scrolling,
   149 		which means it is no longer an authoring error.
   150 		It also allows authors to specify
   151 		that overflow is handled by clipping,
   152 		which makes sense when the author's intent
   153 		is that the content not be shown.
   154 	</p>
   156 	<p>
   157 		However, scrolling is not the only way
   158 		to present large amounts of content,
   159 		and may even not be the optimal way.
   160 		After all, the codex replaced the scroll
   161 		as the common format for large written works
   162 		because of its advantages.
   163 	</p>
   165 	<p>
   166 		This specification introduces
   167 		a mechanism for Web pages to specify
   168 		that an element of a page should handle overflow
   169 		through pagination rather than through scrolling.
   170 	</p>
   172 	<p>
   173 		This specification also extends the concept of overflow
   174 		in another direction.
   175 		Instead of requiring that authors specify a single area
   176 		into which the content of an element must flow,
   177 		this specification allows authors to specify multiple fragments,
   178 		each with their own dimensions and styles,
   179 		so that the content of the element can flow from one to the next,
   180 		using as many as needed to place the content without overflowing.
   181 	</p>
   183 	<p>
   184 		In both of these cases, implementations must
   185 		break the content in the block-progression dimension.
   186 		Implementations must do this is described
   187 		in the CSS Fragmentation Module [[!CSS3-BREAK]].
   188 	</p>
   190 <h2 id="overflow-concepts">Types of overflow</h2>
   192 	<p>
   193 		CSS uses the term <dfn>overflow</dfn> to describe
   194 		the contents of a box
   195 		that extend outside that one of that box's edges
   196 		(i.e., its <i>content edge</i>, <i>padding edge</i>,
   197 		<i>border edge</i>, or <i>margin edge</i>).
   198 		The overflow might be described as the elements or features
   199 		that cause this overflow,
   200 		the non-rectangular region occupied by these features,
   201 		or, more commonly,
   202 		as the minimal rectangle that bounds that region.
   203 		A box's overflow is computed based on the boxes and styles
   204 		of the box and of all its descendants whose containing block chain
   205 		<span class="issue">undefined term?</span>
   206 		includes the box.
   207 	</p>
   209 	<p>
   210 		In most cases, any of these types of overflow
   211 		can be computed for any box
   212 		from the bounds and properties of that box,
   213 		and from the overflow (of that type)
   214 		of each of its children.
   215 		However, this is not always the case; for example,
   216 		when ''transform-style: preserve-3d'' [[CSS3-TRANSFORMS]] is used on
   217 		some of the children, their descendants with
   218 		''transform-style: preserve-3d'' must also be examined.
   219 	</p>
   221 <h3 id="ink-overflow">Ink overflow</h3>
   223 	<p>
   224 		The <dfn id="ink-overflow0">ink overflow</dfn> of a box
   225 		is the part of that box and its contents that
   226 		creates a visual effect outside of
   227 		the box's border box.
   228 	</p>
   230 	<p>
   231 		Since some effects in CSS (for example, the blurs in
   232 		'text-shadow' [[CSS3TEXT]] and 'box-shadow' [[CSS3BG]])
   233 		do not define what visual extent they cover, the extent
   234 		of the <a>ink overflow</a> is undefined.
   235 	</p>
   237 	<p class="issue">
   238 		Should we try to define it at all and just leave pieces undefined?
   239 	</p>
   241 	<p>
   242 		The <dfn>ink overflow region</dfn> is the non-rectangular region
   243 		occupied by the <a>ink overflow</a>, and the
   244 		<dfn>ink overflow rectangle</dfn> is
   245 		the minimal rectangle whose axis is aligned to the box's axes
   246 		and contains the <a>ink overflow region</a>.
   247 		Note that the <a>ink overflow rectangle</a> is a rectangle
   248 		in the box's coordinate system, but might be non-rectangular
   249 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   250 	</p>
   252 <h3 id="scrollable-overflow">Scrollable overflow</h3>
   254 	<p>
   255 		The <dfn id="scrollable-overflow0">scrollable overflow</dfn> of a box is the
   256 		set of things extending outside of that box's padding edge
   257 		for which a scrolling mechanism needs to be provided.
   258 	</p>
   260 	<p class="issue">
   261 		The following definition should be rewritten to use
   262 		the concept of <a href="http://dev.w3.org/csswg/css-transforms/#3d-rendering-context">3D rendering context</a> [[!CSS3-TRANSFORMS]]
   263 		and related terms,
   264 		particularly once those concepts stabilize following changes
   265 		proposed in the CSS WG meeting on the morning of 2014-01-28.
   266 	</p>
   268 	<p>
   269 		Given the following definitions
   270 		<span class="issue">which belong in [[CSS3-TRANSFORMS]]</span>:
   271 	</p>
   273 	<dl>
   274 		<dt><dfn>3d-preserving child</dfn></dt>
   275 		<dd>
   276 			A child box B of a containing block C is a 3d-preserving
   277 			child if it has ''transform-style: preserve-3d''
   278 			and the user-agent is not required to flatten it
   279 			based on the <a href="http://www.w3.org/TR/css3-transforms/#transform-style-property">requirements</a> in [[!CSS3-TRANSFORMS]].
   280 		</dt>
   281 		<dt><dfn>non-3d-preserving child</dfn></dt>
   282 		<dd>
   283 			A child C of a box P is a non-3d-preserving-child if
   284 			it is not a <a>3d-preserving child</a>.
   285 		</dd>
   286 		<dt><dfn>3d-preserving descendant</dfn></dt>
   287 		<dd>
   288 			Box D is a 3d-preserving descendant of box A if A is
   289 			an ancestor of D, and D and all of the boxes (if any)
   290 			in the containing block chain from D to A
   291 			are <a>3d-preserving child</a> boxes.
   292 		</dd>
   293 	</dl>
   295 	<p>The scrollable overflow of a box is the union of the following things,
   296 	all adjusted for transforms <span class="issue">undefined concept!</span> into the box's coordinate space:</p>
   298 	<ul>
   299 		<li>
   300 			for the box and all of its <a>3d-preserving descendant</a> boxes:
   301 			<ul>
   302 				<li>the box's own padding edge (for the box itself) or border edge (for <a>3d-preserving descendant</a> boxes)</li>
   303 				<li>the bounds <span class="issue">undefined term!</span> of any text directly in the box</li>
   304 				<li><span class="issue">MORE HERE!</span>
   305 			</ul>
   306 		<li>
   307 			for all the <a>non-3d-preserving child</a> boxes of the
   308 			box and its <a>3d-preserving descendant</a> boxes,
   309 			the scrollable overflow of the box
   310 		</li>
   311 	</ul>
   313 	<p class="issue">
   314 		I wrote this definition off the top of my head,
   315 		so it can't possibly be right.
   316 		It's missing tons of pieces!
   317 	</p>
   319 	<p class="issue">
   320 		The handling of preserve-3d subtrees here is probably wrong;
   321 		the elements should probably count
   322 		only towards the overflow of the element that flattens them.
   323 	</p>
   325 	<p>
   326 		The <dfn>scrollable overflow region</dfn> is the non-rectangular region
   327 		occupied by the <a>scrollable overflow</a>, and the
   328 		<dfn>scrollable overflow rectangle</dfn> is
   329 		the minimal rectangle whose axis is aligned to the box's axes
   330 		and contains the <a>scrollable overflow region</a>.
   331 		Note that the <a>scrollable overflow rectangle</a> is a rectangle
   332 		in the box's coordinate system, but might be non-rectangular
   333 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   334 	</p>
   336 <h3 id="border-box-overflow">Border box overflow</h3>
   338 	<p class="issue">
   339 		This concept has been proposed for some uses, such as for
   340 		determining what the 'outline' property goes around, and
   341 		as the basis of a coordinate system for specifying clips and masks,
   342 		but it's not clear if it's needed.
   343 	</p>
   345 	<p>
   346 		The <dfn>border-box overflow</dfn> of a box is the
   347 		union of the box's border edge and the border edges of
   348 		the box's descendants.</p>
   349 	</p>
   351 	<p class="issue">
   352 		If needed, define more formally, as for scrollable overflow above.
   353 		(Maybe even share the definitions in an appropriate way!)
   354 	</p>
   356 	<p>
   357 		The <dfn>border-box overflow region</dfn> is the non-rectangular region
   358 		occupied by the <a>border-box overflow</a>, and the
   359 		<dfn>border-box overflow rectangle</dfn> is
   360 		the minimal rectangle whose axis is aligned to the box's axes
   361 		and contains the <a>border-box overflow region</a>.
   362 		Note that the <a>border-box overflow rectangle</a> is a rectangle
   363 		in the box's coordinate system, but might be non-rectangular
   364 		in other coordinate systems due to transforms [[CSS3-TRANSFORMS]].
   365 	</p>
   367 <h2 id="overflow-properties">Overflow properties</h2>
   369 	<p>
   370 		The 'overflow-x' property specifies
   371 		the handling of overflow in the horizontal direction
   372 		(i.e., overflow from the left and right sides of the box),
   373 		and the 'overflow-y' property specifies the handling
   374 		of overflow in the vertical direction
   375 		(i.e., overflow from the top and bottom sides of the box) 
   376 	</p>
   378 	<pre class=propdef>
   379 		Name: overflow-x, overflow-y
   380 		Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments''
   381 		Initial: ''visible''
   382 		Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
   383 		Inherited: no
   384 		Percentages: N/A
   385 		Media: visual
   386 		Computed value: see below
   387 		Animatable: no
   388 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   389 	</pre>
   391 	<p>
   392 		The 'overflow' property is a shorthand property
   393 		that sets the specified values of both 'overflow-x' and 'overflow-y'
   394 		to the value specified for 'overflow'.
   395 	</p>
   397 	<pre class=propdef>
   398 		Name: overflow
   399 		Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments''
   400 		Initial: see individual properties
   401 		Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
   402 		Inherited: no
   403 		Percentages: N/A
   404 		Media: visual
   405 		Computed value: see individual properties
   406 		Animatable: no
   407 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   408 	</pre>
   410 	<p>The values of these properties are:</p>
   412 	<dl dfn-for="overflow" dfn-type="value">
   413 		<dt><dfn>visible</dfn>
   414 		<dd>
   415 			There is no special handling of overflow, that is, it
   416 			may be rendered outside the block container.
   417 		</dd>
   418 		<dt><dfn>hidden</dfn>
   419 		<dt><dfn>scroll</dfn>
   420 		<dt><dfn>auto</dfn>
   421 		<dd>
   422 			These values are collectively the <dfn dfn>scrolling values</dfn>;
   423 			they are defined in the section on
   424 			<a href="#scrolling-overflow">scrolling and hidden overflow</a>.
   425 		</dd>
   426 		<dt><dfn>paged-x</dfn>
   427 		<dt><dfn>paged-y</dfn>
   428 		<dt><dfn>paged-x-controls</dfn>
   429 		<dt><dfn>paged-y-controls</dfn>
   430 		<dt><dfn>fragments</dfn>
   431 		<dd>
   432 			These values are collectively the <dfn dfn>fragmenting values</dfn>;
   433 			they are defined in the sections on
   434 			<a href="#paginated-overflow">paginated overflow</a> and
   435 			<a href="#fragment-overflow">fragment overflow</a>.
   436 		</dd>
   437 	</dl>
   439 	<div id="overflow-computed-values">
   440 		<p>The computed values of 'overflow-x' and 'overflow-y'
   441 		are determined from the cascaded values [[!CSS3CASCADE]]
   442 		based on the following rules:</p>
   444 		<ol>
   445 			<li>
   446 				If one or both of the cascaded values are
   447 				<a>fragmenting values</a>, then:
   448 				<ol>
   449 					<li>
   450 						If one of the cascaded values is one of the
   451 						<a>fragmenting values</a>
   452 						and the other is not,
   453 						then the computed values are
   454 						the same as the cascaded values.
   455 					</li>
   456 					<li>
   457 						If both of the cascaded values are <a>fragmenting values</a>, then:
   458 						<ol>
   459 							<li>
   460 								for horizontal writing mode [[!CSS3-WRITING-MODES]],
   461 								the computed value for 'overflow-y' is the cascaded value
   462 								and the computed value for 'overflow-x' is ''overflow/hidden'', or
   463 							</li>
   464 							<li>
   465 								for vertical writing mode [[!CSS3-WRITING-MODES]],
   466 								the computed value for 'overflow-x' is the cascaded value
   467 								and the computed value for 'overflow-y' is ''overflow/hidden''.
   468 							</li>
   469 						</ol>
   470 					</li>
   471 				</ol>
   472 			</li>
   473 			<li>
   474 				Otherwise, if one cascaded values is
   475 				one of the <a>scrolling values</a>
   476 				and the other is ''overflow/visible'',
   477 				then computed values are the cascaded values
   478 				with ''overflow/visible'' changed to ''overflow/auto''.
   479 			</li>
   480 			<li>
   481 				Otherwise, the computed values are as specified.
   482 			</li>
   483 		</ol>
   484 	</div>
   486 	<p class="issue">
   487 		Are all 4 of the ''paged-*'' values really needed?
   488 	</p>
   490 	<p>
   491 		When the <a>fragmenting values</a> are used,
   492 		the overflow from the fragments themselves
   493 		treats the fragmenting value as ''overflow/hidden''.
   494 		<span class="issue">Is this the right behavior?</span>
   495 		<span class="issue">Give example.</span>
   496 	</p>
   498 	<p class="issue">
   499 		[[CSS3-MARQUEE]] describes an 'overflow-style' property,
   500 		but it has not picked up implementation experience
   501 		that the working group is aware of.
   502 		Should this document treat 'overflow-style' as a defunct proposal,
   503 		or should this document describe the 'overflow-style' property
   504 		and attempt to revive it,
   505 		despite that implementations have implemented
   506 		'overflow-x' and 'overflow-y' instead?
   507 	</p>
   509 	<p class="issue">
   510 		There are <a href="http://lists.w3.org/Archives/Public/www-style/2012May/1197.html">discussions</a>
   511 		about how overflow, overflow-style, overflow-x and overflow-y
   512 		should work and interact with each other.
   513 		Until consensus on this topic is reached,
   514 		it is not completely clear which of these
   515 		should be used for
   516 		paged-x | paged-y | paged-x-controls | paged-y-controls | fragments
   517 	</p>
   519 <h2 id="scrolling-overflow">Scrolling and hidden overflow</h2>
   521 	<p class="issue">
   522 		Move material from [[CSS21]] and [[CSS3BOX]] here.
   523 	</p>
   525 	<p class="issue">
   526 		Explain which directions allow scrolling and which don't,
   527 		as a function of 'direction'
   528 		(including propagation of 'direction' to the ICB).
   529 	</p>
   531 <h2 id="paginated-overflow">Paginated overflow</h2>
   533 <p class="issue">overflow:paginate or overflow:pages (or paged-x, paged-y, paged-x-controls, paged-y-controls as [[CSS3GCPM]] has?)</p>
   535 <p class="issue">Ability to display N pages at once
   536 rather than just one page at once?</p>
   538 	<p class="issue">
   539 		The current implementation of paginated overflow uses
   540 		the 'overflow'/'overflow-x'/'overflow-y' properties
   541 		rather than the 'overflow-style' property as proposed
   542 		in the [[CSS3GCPM]] draft
   543 		(which also matches the [[CSS3-MARQUEE]] proposal).
   544 		We should probably switch away from 'overflow-style',
   545 		but that's not 100% clear.
   546 	</p>
   548 <h2 id="fragment-overflow">Fragment overflow</h2>
   550 	<p>
   551 		This section introduces and defines the meaning of
   552 		the new ''fragments'' value of the 'overflow' property.
   553 	</p>
   555 	<p>
   556 		When the computed value of 'overflow' for an element is ''fragments'',
   557 		and implementations would otherwise have created a box for the element,
   558 		then implementations must create a sequence of <dfn>fragment box</dfn>es
   559 		for that element.
   560 		(It is possible for an element with ''overflow: fragments''
   561 		to generate only one <a>fragment box</a>.
   562 		However, if an element's computed 'overflow' is not ''fragments'',
   563 		then its box is not a <a>fragment box</a>.)
   564 		Every <a>fragment box</a> is a fragmentation container,
   565 		and any overflow
   566 		that would cause that fragmentation container to fragment
   567 		causes another <a>fragment box</a> created as a next sibling
   568 		of the previous one.
   569 		<span class="issue">Or is it as though it's a next sibling of
   570 		the element?  Need to figure out exactly how this interacts with
   571 		other box-level fixup.</span>
   572 		Additionally, if the <a>fragment box</a> is also
   573 		a multi-column box (as defined in [[!CSS3COL]]
   574 		<span class="issue">though it defines <i>multi-column element</i></span>)
   575 		any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
   576 		instead is flown into an additional fragment box.
   577 		However, fragment boxes may themselves be broken
   578 		(due to fragmentation in a fragmentation context outside of them,
   579 		such as pages, columns, or other fragment boxes);
   580 		such breaking leads to fragments of the same fragment box
   581 		rather than multiple fragment boxes.
   582 		(This matters because fragment boxes may be styled by their index;
   583 		such breaking leads to multiple fragments of a fragment box
   584 		with a single index.
   585 		This design choice is so that
   586 		breaking a fragment box across pages does not break
   587 		the association of indices to particular pieces of content.)
   588 		<span class="issue">Should a forced break that breaks to
   589 		an outer fragmentation context cause a new fragment of a single
   590 		fragment box or a new fragment box?</span>
   591 		<span class="issue">Should we find a term other than
   592 		<a>fragment box</a> here to make this a little less confusing?</span>
   593 	</p>
   595 	<p class="issue">
   596 		What if we want to be able to style the pieces of an element
   597 		split within another type of fragmentation context?
   598 		These rules prevent ever using ''::nth-fragment()'' for that,
   599 		despite that the name seems the most logical name for such a feature.
   600 	</p>
   602 	<div class="example">
   603 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   604 &lt;title&gt;Breaking content into
   605   equal-sized cards&lt;/title&gt;
   606 &lt;style&gt;
   607   .in-cards {
   608     overflow: fragments;
   610     width: 13em;
   611     height: 8em;
   613     padding: 4px;
   614     border: medium solid blue;
   615     margin: 6px;
   617     font: medium/1.3 Times New
   618       Roman, Times, serif;
   619   }
   620 &lt;/style&gt;
   621 &lt;div class="in-cards"&gt;
   622   In this example, the text in the div
   623   is broken into a series of cards.
   624   These cards all have the same style.
   625   The presence of enough content to
   626   overflow one of the cards causes
   627   another one to be created.  The second
   628   card is created just like it's the
   629   next sibling of the first.
   630 &lt;/div&gt;</pre></td><td>
   631 			<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>
   632 			<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>
   633 		</td></tr></table>
   634 	</div>
   636 	<p class="issue">
   637 		We should specify that ''overflow: fragments'' does not apply
   638 		to at least some table parts,
   639 		and perhaps other elements as well.
   640 		We need to determine exactly which ones.
   641 	</p>
   643 	<p class="issue">
   644 		This specification needs to say which type of
   645 		fragmentation context is created
   646 		so that it's clear which values of the 'break-*' properties
   647 		cause breaks within this context.
   648 		We probably want ''break-*: region'' to apply.
   649 	</p>
   651 	<p class="issue">
   652 		This specification needs a processing model
   653 		that will apply in cases where the layout containing the
   654 		fragments has characteristics that use the intrinsic size of the fragments
   655 		to change the amount of space available for them,
   656 		such as [[CSS3-GRID-LAYOUT]].
   657 		There has already been some work on such a processing model
   658 		in [[CSS3-REGIONS]],
   659 		and the work done on a model there,
   660 		and the editors of that specification,
   661 		should inform what happens in this specification.
   662 	</p>
   664 <h3 id="fragment-styling">Fragment styling</h3>
   666 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
   668 	<p>
   669 		The <dfn selector>::nth-fragment()</dfn> pseudo-element
   670 		is a pseudo-element
   671 		that describes some of the <a>fragment box</a>es generated by an element.
   672 		The argument to the pseudo-element takes the same syntax
   673 		as the argument to the :nth-child() pseudo-class
   674 		defined in [[!SELECT]], and has the same meaning
   675 		except that the number is relative to
   676 		<a>fragment box</a>es generated by the element
   677 		instead of siblings of the element.
   678 	</p>
   680 	<p class="note">
   681 		Selectors that allow addressing fragments
   682 		by counting from the end rather than the start
   683 		are intentionally not provided.
   684 		Such selectors would interfere with determining
   685 		the number of fragments.
   686 	</p>
   688 	<p class="issue">
   689 		Depending on future discussions,
   690 		this ''::nth-fragment(<var>an+b</var>)'' syntax
   691 		may be replaced with
   692 		the new ''::fragment:nth(<var>an+b</var>)'' syntax.
   693 	</p>
   695 <h4 id="style-of-fragments">Styling of fragments</h4>
   697 	<p class="issue">
   698 		Should this apply to fragment overflow only,
   699 		or also to paginated overflow?
   700 		(If it applies,
   701 		then stricter property restrictions would be needed
   702 		for paginated overflow.)
   703 	</p>
   705 	<p>
   706 		In the absence of rules with ''::nth-fragment()'' pseudo-elements,
   707 		the computed style for each <a>fragment box</a>
   708 		is the computed style for the element
   709 		for which the <a>fragment box</a> was created.
   710 		However, the style for a <a>fragment box</a> is also influenced
   711 		by rules whose selector's <a>subject</a> [[!SELECT]]
   712 		has an ''::nth-fragment()'' pseudo-element,
   713 		if the 1-based number of the <a>fragment box</a> matches
   714 		that ''::nth-fragment()'' pseudo-element
   715 		and the selector (excluding the ''::nth-fragment()'' pseudo-element)
   716 		matches the element generating the fragments.
   717 	</p>
   719 	<p>
   720 		When determining the style of the <a>fragment box</a>,
   721 		these rules that match the fragment pseudo-element
   722 		cascade together with the rules that match the element,
   723 		with the fragment pseudo-element adding the specificity
   724 		of a pseudo-class to the specificity calculation.
   725 		<span class="issue">Does this need to be specified in
   726 		the cascading module as well?</span>
   727 	</p>
   729 	<div class="example">
   730 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   731 &lt;style&gt;
   732   .bouncy-columns {
   733     overflow: fragments;
   734     width: 6em;
   735     height: 10em;
   736     float: left;
   737     margin: 1em;
   738     font: medium/1.25 Times New
   739       Roman, Times, serif;
   740   }
   741   .bouncy-columns::nth-fragment(1) {
   742     background: aqua; color: black;
   743     transform: rotate(-3deg);
   744   }
   745   .bouncy-columns::nth-fragment(2) {
   746     background: yellow; color: black;
   747     transform: rotate(3deg);
   748   }
   749 &lt;/style&gt;
   750 &lt;div class="bouncy-columns"&gt;
   751   <i>...</i>
   752 &lt;/div&gt;</pre></td><td>
   753 			<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>
   754 			<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>
   755 			<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>
   756 		</td></tr></table>
   757 	</div>
   759 	<p>
   760 		Styling an ''::nth-fragment()'' pseudo-element with the 'overflow'
   761 		property does take effect;
   762 		if a <a>fragment box</a> has a
   763 		computed value of 'overflow' other than ''fragments''
   764 		then that fragment box is the last fragment.
   765 		However, overriding 'overflow' on the first fragment
   766 		does not cause the <a>fragment box</a> not to exist;
   767 		whether there are fragment boxes at all is determined by
   768 		the computed value of overflow for the element.
   769 		<span class="issue">Need to reword this to refer to the
   770 		appropriate choice of 'overflow-x' or 'overflow-y',
   771 		and then point to rule about the handling of the other one
   772 		of 'overflow-x' or 'overflow-y'.</span>
   773 	</p>
   775 	<p>
   776 		Styling an ''::nth-fragment()'' pseudo-element with the 'content'
   777 		property has no effect;
   778 		the computed value of 'content' for the fragment box
   779 		remains the same as the computed value of content for the element.
   780 	</p>
   782 	<p>
   783 		Specifying ''display: none'' for a <a>fragment box</a> causes
   784 		the fragment box with that index not to be generated.
   785 		However, in terms of the indices
   786 		used for matching ''::nth-fragment()'' pseudo-elements
   787 		of later fragment boxes,
   788 		it still counts as though it was generated.
   789 		However, since it is not generated, it does not contain any content.
   790 	</p>
   792 	<p>
   793 		Specifying other values of 'display', 'position',
   794 		or 'float' is permitted, but is not allowed to change
   795 		the computed value of 'display-inside'.
   796 		(Since 'overflow', 'overflow-x', and 'overflow-y' only
   797 		apply to block containers, flex containers, and grid containers
   798 		the computed value of 'display-inside' is always
   799 		''display-inside/block'', ''display-inside/flex'', or
   800 		''display-inside/grid''.
   801 		<span class="issue">Need to specify exactly how this works,
   802 		but it depends on
   803 		having 'display-inside' and 'display-outside' specified.</span>
   804 	</p>
   806 	<p>
   807 		To match the model for other pseudo-elements
   808 		where the pseudo-elements live inside their corresponding element,
   809 		declarations in ''::nth-fragment()'' pseudo-elements override
   810 		declarations in rules without the pseudo-element.
   811 		The relative priority within such declarations is determined
   812 		by normal cascading order (see [[!CSS21]]).
   813 	</p>
   815 	<p>
   816 		Styles specified on ''::nth-fragment()'' pseudo-elements
   817 		do affect inheritance to content within the <a>fragment box</a>.
   818 		In other words, the content within the <a>fragment box</a> must
   819 		inherit from the fragment box's style (i.e., the pseudo-element style)
   820 		rather than directly from the element.
   821 		This means that elements split between fragment boxes may
   822 		have different styles for different parts of the element.
   823 	</p>
   825 	<p class="issue">
   826 		This inheritance rule allows specifying styles indirectly
   827 		(by using explicit ''inherit'' or using default inheritance
   828 		on properties that don't apply to ''::first-letter'')
   829 		that can't be specified directly
   830 		(based on the rules in the next section).
   831 		This is a problem.
   832 		The restrictions that apply to styling inside fragments
   833 		should also apply to inheritance from fragments.
   834 	</p>
   836 	<div class="example">
   837 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   838 &lt;style&gt;
   839   .article {
   840     overflow: fragments;
   841   }
   842   .article::nth-fragment(1) {
   843     font-size: 1.5em;
   844     margin-bottom: 1em;
   845     height: 4em;
   846   }
   847   .article::nth-fragment(2) {
   848     margin-left: 5em;
   849     margin-right: 2em;
   850   }
   851 &lt;/style&gt;
   852 &lt;div class="article"&gt;
   853   The &lt;code&gt;font-size&lt;/code&gt; property<i>...</i>
   854 &lt;/div&gt;</pre></td><td>
   855 			<div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
   856 			<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>
   857 		</td></tr></table>
   858 	</div>
   860 <h4 id="style-in-fragments">Styling inside fragments</h4>
   862 	<p class="issue">
   863 		Should this apply to fragment overflow only,
   864 		or also to paginated overflow,
   865 		or even to pagination across pages?
   866 	</p>
   868 	<p>
   869 		The ''::nth-fragment()'' pseudo-element
   870 		can also be used to style
   871 		content inside of a <a>fragment box</a>.
   872 		Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
   873 		the ''::nth-fragment()'' pseudo-element can be applied
   874 		to parts of the selector other than the subject:
   875 		in particular, it can match ancestors of the subject.
   876 		However, the only CSS properties applied
   877 		by rules with such selectors
   878 		are those that apply
   879 		to the ''::first-letter'' pseudo-element.
   880 	</p>
   882 	<p>
   883 		To be more precise,
   884 		when a rule's selector has ''::nth-fragment()'' pseudo-elements
   885 		attached to parts of the selector other than the subject,
   886 		the declarations in that rule apply to
   887 		a fragment (or pseudo-element thereof) when:
   888 	</p>
   889 	<ol>
   890 		<li>
   891 			the declarations are for properties that apply to the
   892 			''::first-letter'' pseudo-element,
   893 		</li>
   894 		<li>
   895 			the declarations would apply to
   896 			that fragment (or pseudo-element thereof)
   897 			had those ''::nth-fragment()'' pseudo-elements been removed,
   898 			with a particular association between
   899 			each sequence of simple selectors and the element it matched,
   900 			and
   901 		</li>
   902 		<li>
   903 			for each removed ''::nth-fragment()'' pseudo-element,
   904 			the fragment lives within a <a>fragment box</a>
   905 			of the element associated in that association
   906 			with the selector that the pseudo-element was attached to,
   907 			and whose index matches the pseudo-element.
   908 		</li>
   909 	</ol>
   911 	<div class="example">
   912 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   913 &lt;style&gt;
   914   .dark-columns {
   915     overflow: fragments;
   916     width: 6em;
   917     height: 10em;
   918     float: left;
   919     margin-right: 1em;
   920     font: medium/1.25 Times New
   921       Roman, Times, serif;
   922   }
   923   .dark-columns::nth-fragment(1) {
   924     background: aqua; color: black;
   925   }
   926   .dark-columns::nth-fragment(1) :link {
   927     color: blue;
   928   }
   929   .dark-columns::nth-fragment(1) :visited {
   930     color: purple;
   931   }
   932   .dark-columns::nth-fragment(2) {
   933     background: navy; color: white;
   934   }
   935   .dark-columns::nth-fragment(2) :link {
   936     color: aqua;
   937   }
   938   .dark-columns::nth-fragment(2) :visited {
   939     color: fuchsia;
   940   }
   941 &lt;/style&gt;
   942 &lt;div class="dark-columns"&gt;
   943   <i>...</i>
   944 &lt;/div&gt;</pre></td><td>
   945 			<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>
   946 			<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>
   947 		</td></tr></table>
   948 	</div>
   951 <h3 id="max-lines">The 'max-lines' property</h3>
   953 	<p>
   954 		Authors may wish to style the opening lines of an element
   955 		with different styles
   956 		by putting those opening lines in a separate fragment.
   957 		However, since it may be difficult to predict the exact height
   958 		occupied by those lines
   959 		in order to restrict the first fragment to that height,
   960 		this specification introduces a 'max-lines' property
   961 		that forces a fragment to break
   962 		after a specified number of lines.
   963 		This forces a break after the given number of lines
   964 		contained within the element or its descendants,
   965 		as long as those lines are in the same block formatting context.
   966 	</p>
   968 	<pre class=propdef>
   969 		Name: max-lines
   970 		Value: ''none'' | &lt;integer&gt;
   971 		Initial: ''none''
   972 		Applies to: fragment boxes
   973 		Inherited: no
   974 		Animatable: as <a href="http://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
   975 		Percentages: N/A
   976 		Media: visual
   977 		Computed value: specified value
   978 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   979 	</pre>
   981 	<dl dfn-for="max-lines" dfn-type="value">
   982 		<dt><dfn>none</dfn>
   983 		<dd>
   984 			<p>
   985 				Breaks occur only as specified elsewhere.
   986 			</p>
   987 		</dd>
   989 		<dt><dfn>&lt;integer&gt;</dfn>
   990 		<dd>
   991 			<p>
   992 				In addition to any breaks specified elsewhere,
   993 				a break is forced before any line that would exceed
   994 				the given number of lines
   995 				being placed inside the element
   996 				(excluding lines that are in
   997 				a different block formatting context from
   998 				the block formatting context to which
   999 				an unstyled child of the element would belong).
  1000 			</p>
  1002 			<p class="issue">
  1003 				If there are multiple boundaries between this line
  1004 				and the previous, where exactly (in terms of element
  1005 				boundaries) is the break forced?
  1006 			</p>
  1008 			<p>
  1009 				Only positive integers are accepted.
  1010 				Zero or negative integers are a parse error.
  1011 			</p>
  1012 		</dd>
  1013 	</dl>
  1015 <p class="issue">Should this apply to fragment overflow only, or also
  1016 to pagination?</p>
  1018 	<div class="example">
  1019 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
  1020 &lt;style&gt;
  1021   .article {
  1022     overflow: fragments;
  1024   .article::first-letter {
  1025     font-size: 2em;
  1026     line-height: 0.9;
  1028   .article::nth-fragment(1) {
  1029     font-size: 1.5em;
  1030     max-lines: 3;
  1032   .article::nth-fragment(2) {
  1033     column-count: 2;
  1035 &lt;/style&gt;
  1036 &lt;div class="article"&gt;
  1037   <i>...</i>
  1038 &lt;/div&gt;</pre></td><td>
  1039 			<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>
  1040 			<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>
  1041 			<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>
  1042 		</td></tr></table>
  1043 	</div>
  1045 <h2 id="static-media">Overflow in static media</h2>
  1047 	<p class="issue">
  1048 		This specification should define useful behavior
  1049 		for all values of 'overflow'
  1050 		in static media (such as print).
  1051 		Current implementation behavior is quite poor and
  1052 		produces unexpected results when authors have not considered
  1053 		what will happen when
  1054 		the content they produce for interactive media
  1055 		is printed.
  1056 	</p>
  1058 <h2 class=no-num id="acknowledgments">
  1059 Acknowledgments</h2>
  1061 	<p>
  1062 		Thanks especially to the feedback from
  1063 		Rossen Atanassov,
  1064 		Bert Bos,
  1065 		Tantek Çelik,
  1066 		John Daggett,
  1067 		fantasai,
  1068 		Daniel Glazman,
  1069 		Vincent Hardy,
  1070 		H&aring;kon Wium Lie,
  1071 		Peter Linss,
  1072 		Robert O'Callahan,
  1073 		Florian Rivoal,
  1074 		Alan Stearns,
  1075 		Steve Zilles,
  1076 		and all the rest of the
  1077 		<a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
  1078 	</p>

mercurial