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.

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

mercurial