css-overflow/Overview.bs

Wed, 28 Jan 2015 15:18:40 -0800

author
L. David Baron <[email protected]>
date
Wed, 28 Jan 2015 15:18:40 -0800
changeset 15125
f89d93413b7a
parent 15120
76428f3c0f35
child 15180
de66068e2396
permissions
-rw-r--r--

Update links to CSSWG mercurial repository to point to new primary repository.

This links to what is now the canonical URL for this repository, avoids
a redirect, and avoids linking to a server that might go away.

For more details about the repository change, see:
https://lists.w3.org/Archives/Member/w3c-css-wg/2014OctDec/0282.html
or the parallel message for the FXTF repository (which is public):
https://lists.w3.org/Archives/Public/public-fx/2014OctDec/0135.html

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

mercurial