css-overflow/Overview.bs

Tue, 27 Jan 2015 16:10:12 -0800

author
L. David Baron <[email protected]>
date
Tue, 27 Jan 2015 16:10:12 -0800
changeset 15119
812158273d42
parent 15118
3cc923a1e530
child 15120
76428f3c0f35
permissions
-rw-r--r--

[css-overflow] Convert propdef tables to bikeshed syntax.

     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://dvcs.w3.org/hg/csswg/log/tip/css-overflow/Overview.bs">from 27 January 2015 to the present</a>
    14 !Change Log: <a href="https://dvcs.w3.org/hg/csswg/log/tip/css-overflow/Overview.src.html">from 28 March 2013 to 27 January 2015</a>
    15 !Change Log: <a href="https://dvcs.w3.org/hg/csswg/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 ::nth-fragment() pseudo-element is a pseudo-element
   670 		that describes some of the <a>fragment box</a>es generated by an element.
   671 		The argument to the pseudo-element takes the same syntax
   672 		as the argument to the :nth-child() pseudo-class
   673 		defined in [[!SELECT]], and has the same meaning
   674 		except that the number is relative to
   675 		<a>fragment box</a>es generated by the element
   676 		instead of siblings of the element.
   677 	</p>
   679 	<p class="note">
   680 		Selectors that allow addressing fragments
   681 		by counting from the end rather than the start
   682 		are intentionally not provided.
   683 		Such selectors would interfere with determining
   684 		the number of fragments.
   685 	</p>
   687 	<p class="issue">
   688 		Depending on future discussions,
   689 		this ''::nth-fragment(<var>an+b</var>)'' syntax
   690 		may be replaced with
   691 		the new ''::fragment:nth(<var>an+b</var>)'' syntax.
   692 	</p>
   694 <h4 id="style-of-fragments">Styling of fragments</h4>
   696 	<p class="issue">
   697 		Should this apply to fragment overflow only,
   698 		or also to paginated overflow?
   699 		(If it applies,
   700 		then stricter property restrictions would be needed
   701 		for paginated overflow.)
   702 	</p>
   704 	<p>
   705 		In the absence of rules with ''::nth-fragment()'' pseudo-elements,
   706 		the computed style for each <a>fragment box</a>
   707 		is the computed style for the element
   708 		for which the <a>fragment box</a> was created.
   709 		However, the style for a <a>fragment box</a> is also influenced
   710 		by rules whose selector's <a>subject</a> [[!SELECT]]
   711 		has an ''::nth-fragment()'' pseudo-element,
   712 		if the 1-based number of the <a>fragment box</a> matches
   713 		that ''::nth-fragment()'' pseudo-element
   714 		and the selector (excluding the ''::nth-fragment()'' pseudo-element)
   715 		matches the element generating the fragments.
   716 	</p>
   718 	<p>
   719 		When determining the style of the <a>fragment box</a>,
   720 		these rules that match the fragment pseudo-element
   721 		cascade together with the rules that match the element,
   722 		with the fragment pseudo-element adding the specificity
   723 		of a pseudo-class to the specificity calculation.
   724 		<span class="issue">Does this need to be specified in
   725 		the cascading module as well?</span>
   726 	</p>
   728 	<div class="example">
   729 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   730 &lt;style&gt;
   731   .bouncy-columns {
   732     overflow: fragments;
   733     width: 6em;
   734     height: 10em;
   735     float: left;
   736     margin: 1em;
   737     font: medium/1.25 Times New
   738       Roman, Times, serif;
   739   }
   740   .bouncy-columns::nth-fragment(1) {
   741     background: aqua; color: black;
   742     transform: rotate(-3deg);
   743   }
   744   .bouncy-columns::nth-fragment(2) {
   745     background: yellow; color: black;
   746     transform: rotate(3deg);
   747   }
   748 &lt;/style&gt;
   749 &lt;div class="bouncy-columns"&gt;
   750   <i>...</i>
   751 &lt;/div&gt;</pre></td><td>
   752 			<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>
   753 			<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>
   754 			<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>
   755 		</td></tr></table>
   756 	</div>
   758 	<p>
   759 		Styling an ''::nth-fragment()'' pseudo-element with the 'overflow'
   760 		property does take effect;
   761 		if a <a>fragment box</a> has a
   762 		computed value of 'overflow' other than ''fragments''
   763 		then that fragment box is the last fragment.
   764 		However, overriding 'overflow' on the first fragment
   765 		does not cause the <a>fragment box</a> not to exist;
   766 		whether there are fragment boxes at all is determined by
   767 		the computed value of overflow for the element.
   768 		<span class="issue">Need to reword this to refer to the
   769 		appropriate choice of 'overflow-x' or 'overflow-y',
   770 		and then point to rule about the handling of the other one
   771 		of 'overflow-x' or 'overflow-y'.</span>
   772 	</p>
   774 	<p>
   775 		Styling an ''::nth-fragment()'' pseudo-element with the 'content'
   776 		property has no effect;
   777 		the computed value of 'content' for the fragment box
   778 		remains the same as the computed value of content for the element.
   779 	</p>
   781 	<p>
   782 		Specifying ''display: none'' for a <a>fragment box</a> causes
   783 		the fragment box with that index not to be generated.
   784 		However, in terms of the indices
   785 		used for matching ''::nth-fragment()'' pseudo-elements
   786 		of later fragment boxes,
   787 		it still counts as though it was generated.
   788 		However, since it is not generated, it does not contain any content.
   789 	</p>
   791 	<p>
   792 		Specifying other values of 'display', 'position',
   793 		or 'float' is permitted, but is not allowed to change
   794 		the computed value of 'display-inside'.
   795 		(Since 'overflow', 'overflow-x', and 'overflow-y' only
   796 		apply to block containers, flex containers, and grid containers
   797 		the computed value of 'display-inside' is always
   798 		''display-inside/block'', ''display-inside/flex'', or
   799 		''display-inside/grid''.
   800 		<span class="issue">Need to specify exactly how this works,
   801 		but it depends on
   802 		having 'display-inside' and 'display-outside' specified.</span>
   803 	</p>
   805 	<p>
   806 		To match the model for other pseudo-elements
   807 		where the pseudo-elements live inside their corresponding element,
   808 		declarations in ''::nth-fragment()'' pseudo-elements override
   809 		declarations in rules without the pseudo-element.
   810 		The relative priority within such declarations is determined
   811 		by normal cascading order (see [[!CSS21]]).
   812 	</p>
   814 	<p>
   815 		Styles specified on ''::nth-fragment()'' pseudo-elements
   816 		do affect inheritance to content within the <a>fragment box</a>.
   817 		In other words, the content within the <a>fragment box</a> must
   818 		inherit from the fragment box's style (i.e., the pseudo-element style)
   819 		rather than directly from the element.
   820 		This means that elements split between fragment boxes may
   821 		have different styles for different parts of the element.
   822 	</p>
   824 	<p class="issue">
   825 		This inheritance rule allows specifying styles indirectly
   826 		(by using explicit ''inherit'' or using default inheritance
   827 		on properties that don't apply to ''::first-letter'')
   828 		that can't be specified directly
   829 		(based on the rules in the next section).
   830 		This is a problem.
   831 		The restrictions that apply to styling inside fragments
   832 		should also apply to inheritance from fragments.
   833 	</p>
   835 	<div class="example">
   836 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   837 &lt;style&gt;
   838   .article {
   839     overflow: fragments;
   840   }
   841   .article::nth-fragment(1) {
   842     font-size: 1.5em;
   843     margin-bottom: 1em;
   844     height: 4em;
   845   }
   846   .article::nth-fragment(2) {
   847     margin-left: 5em;
   848     margin-right: 2em;
   849   }
   850 &lt;/style&gt;
   851 &lt;div class="article"&gt;
   852   The &lt;code&gt;font-size&lt;/code&gt; property<i>...</i>
   853 &lt;/div&gt;</pre></td><td>
   854 			<div class="article-font-inherit-demo one">The <code>font-size</code> property<br>specified on the fragment<br>is inherited into the</div>
   855 			<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>
   856 		</td></tr></table>
   857 	</div>
   859 <h4 id="style-in-fragments">Styling inside fragments</h4>
   861 	<p class="issue">
   862 		Should this apply to fragment overflow only,
   863 		or also to paginated overflow,
   864 		or even to pagination across pages?
   865 	</p>
   867 	<p>
   868 		The ''::nth-fragment()'' pseudo-element
   869 		can also be used to style
   870 		content inside of a <a>fragment box</a>.
   871 		Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
   872 		the ''::nth-fragment()'' pseudo-element can be applied
   873 		to parts of the selector other than the subject:
   874 		in particular, it can match ancestors of the subject.
   875 		However, the only CSS properties applied
   876 		by rules with such selectors
   877 		are those that apply
   878 		to the ''::first-letter'' pseudo-element.
   879 	</p>
   881 	<p>
   882 		To be more precise,
   883 		when a rule's selector has ''::nth-fragment()'' pseudo-elements
   884 		attached to parts of the selector other than the subject,
   885 		the declarations in that rule apply to
   886 		a fragment (or pseudo-element thereof) when:
   887 	</p>
   888 	<ol>
   889 		<li>
   890 			the declarations are for properties that apply to the
   891 			''::first-letter'' pseudo-element,
   892 		</li>
   893 		<li>
   894 			the declarations would apply to
   895 			that fragment (or pseudo-element thereof)
   896 			had those ''::nth-fragment()'' pseudo-elements been removed,
   897 			with a particular association between
   898 			each sequence of simple selectors and the element it matched,
   899 			and
   900 		</li>
   901 		<li>
   902 			for each removed ''::nth-fragment()'' pseudo-element,
   903 			the fragment lives within a <a>fragment box</a>
   904 			of the element associated in that association
   905 			with the selector that the pseudo-element was attached to,
   906 			and whose index matches the pseudo-element.
   907 		</li>
   908 	</ol>
   910 	<div class="example">
   911 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
   912 &lt;style&gt;
   913   .dark-columns {
   914     overflow: fragments;
   915     width: 6em;
   916     height: 10em;
   917     float: left;
   918     margin-right: 1em;
   919     font: medium/1.25 Times New
   920       Roman, Times, serif;
   921   }
   922   .dark-columns::nth-fragment(1) {
   923     background: aqua; color: black;
   924   }
   925   .dark-columns::nth-fragment(1) :link {
   926     color: blue;
   927   }
   928   .dark-columns::nth-fragment(1) :visited {
   929     color: purple;
   930   }
   931   .dark-columns::nth-fragment(2) {
   932     background: navy; color: white;
   933   }
   934   .dark-columns::nth-fragment(2) :link {
   935     color: aqua;
   936   }
   937   .dark-columns::nth-fragment(2) :visited {
   938     color: fuchsia;
   939   }
   940 &lt;/style&gt;
   941 &lt;div class="dark-columns"&gt;
   942   <i>...</i>
   943 &lt;/div&gt;</pre></td><td>
   944 			<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>
   945 			<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>
   946 		</td></tr></table>
   947 	</div>
   950 <h3 id="max-lines">The 'max-lines' property</h3>
   952 	<p>
   953 		Authors may wish to style the opening lines of an element
   954 		with different styles
   955 		by putting those opening lines in a separate fragment.
   956 		However, since it may be difficult to predict the exact height
   957 		occupied by those lines
   958 		in order to restrict the first fragment to that height,
   959 		this specification introduces a 'max-lines' property
   960 		that forces a fragment to break
   961 		after a specified number of lines.
   962 		This forces a break after the given number of lines
   963 		contained within the element or its descendants,
   964 		as long as those lines are in the same block formatting context.
   965 	</p>
   967 	<pre class=propdef>
   968 		Name: max-lines
   969 		Value: none | &lt;integer&gt;
   970 		Initial: none
   971 		Applies to: fragment boxes
   972 		Inherited: no
   973 		Animatable: as <a href="http://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
   974 		Percentages: N/A
   975 		Media: visual
   976 		Computed value: specified value
   977 		Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
   978 	</pre>
   980 	<dl dfn-for="max-lines" dfn-type="value">
   981 		<dt><dfn>none</dfn>
   982 		<dd>
   983 			<p>
   984 				Breaks occur only as specified elsewhere.
   985 			</p>
   986 		</dd>
   988 		<dt><dfn>&lt;integer&gt;</dfn>
   989 		<dd>
   990 			<p>
   991 				In addition to any breaks specified elsewhere,
   992 				a break is forced before any line that would exceed
   993 				the given number of lines
   994 				being placed inside the element
   995 				(excluding lines that are in
   996 				a different block formatting context from
   997 				the block formatting context to which
   998 				an unstyled child of the element would belong).
   999 			</p>
  1001 			<p class="issue">
  1002 				If there are multiple boundaries between this line
  1003 				and the previous, where exactly (in terms of element
  1004 				boundaries) is the break forced?
  1005 			</p>
  1007 			<p>
  1008 				Only positive integers are accepted.
  1009 				Zero or negative integers are a parse error.
  1010 			</p>
  1011 		</dd>
  1012 	</dl>
  1014 <p class="issue">Should this apply to fragment overflow only, or also
  1015 to pagination?</p>
  1017 	<div class="example">
  1018 		<table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
  1019 &lt;style&gt;
  1020   .article {
  1021     overflow: fragments;
  1023   .article::first-letter {
  1024     font-size: 2em;
  1025     line-height: 0.9;
  1027   .article::nth-fragment(1) {
  1028     font-size: 1.5em;
  1029     max-lines: 3;
  1031   .article::nth-fragment(2) {
  1032     column-count: 2;
  1034 &lt;/style&gt;
  1035 &lt;div class="article"&gt;
  1036   <i>...</i>
  1037 &lt;/div&gt;</pre></td><td>
  1038 			<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>
  1039 			<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>
  1040 			<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>
  1041 		</td></tr></table>
  1042 	</div>
  1044 <h2 id="static-media">Overflow in static media</h2>
  1046 	<p class="issue">
  1047 		This specification should define useful behavior
  1048 		for all values of 'overflow'
  1049 		in static media (such as print).
  1050 		Current implementation behavior is quite poor and
  1051 		produces unexpected results when authors have not considered
  1052 		what will happen when
  1053 		the content they produce for interactive media
  1054 		is printed.
  1055 	</p>
  1057 <h2 class=no-num id="acknowledgments">
  1058 Acknowledgments</h2>
  1060 	<p>
  1061 		Thanks especially to the feedback from
  1062 		Rossen Atanassov,
  1063 		Bert Bos,
  1064 		Tantek Çelik,
  1065 		John Daggett,
  1066 		fantasai,
  1067 		Daniel Glazman,
  1068 		Vincent Hardy,
  1069 		H&aring;kon Wium Lie,
  1070 		Peter Linss,
  1071 		Robert O'Callahan,
  1072 		Florian Rivoal,
  1073 		Alan Stearns,
  1074 		Steve Zilles,
  1075 		and all the rest of the
  1076 		<a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
  1077 	</p>

mercurial