css-overflow/Overview.bs

Thu, 04 Feb 2016 09:45:32 +1100

author
Florian Rivoal <[email protected]>
date
Thu, 04 Feb 2016 09:45:32 +1100
changeset 17019
bab8c985fbe9
parent 16999
02a27e98e286
child 17268
737da05ea38b
permissions
-rw-r--r--

Update affiliation

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

mercurial