css-overflow/Overview.bs

Fri, 29 May 2015 16:46:19 -0700

author
Tab Atkins <[email protected]>
date
Fri, 29 May 2015 16:46:19 -0700
changeset 15674
0f4bf02e8b70
parent 15497
cc8044604ac7
child 15804
6aa19556cbea
permissions
-rw-r--r--

Add 'Work Status' metadata to all Bikeshed source files. Some files also accidentally got whitespace fixes, whoops.

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

mercurial