css-overflow/Overview.bs

Thu, 03 Nov 2016 15:42:32 +0900

author
Florian Rivoal <[email protected]>
date
Thu, 03 Nov 2016 15:42:32 +0900
changeset 18362
654f466cd649
parent 18303
bdfa4f971f75
child 18647
d577d0a1ba38
permissions
-rw-r--r--

[css-overflow] upgrade to MUST requirements about overflow:hidden

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@18303 11 Editor: L. David Baron, Mozilla https://www.mozilla.org/, https://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@7811 340 <h2 id="overflow-properties">Overflow properties</h2>
dbaron@7811 341
dbaron@7814 342 <p>
dbaron@15114 343 The 'overflow-x' property specifies
dbaron@7814 344 the handling of overflow in the horizontal direction
dbaron@7814 345 (i.e., overflow from the left and right sides of the box),
dbaron@15114 346 and the 'overflow-y' property specifies the handling
dbaron@7814 347 of overflow in the vertical direction
jackalmage@15301 348 (i.e., overflow from the top and bottom sides of the box)
dbaron@7814 349 </p>
dbaron@7814 350
dbaron@15119 351 <pre class=propdef>
dbaron@15119 352 Name: overflow-x, overflow-y
florian@15497 353 Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
dbaron@15180 354 Initial: ''visible''
dbaron@15119 355 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
dbaron@15119 356 Inherited: no
dbaron@15119 357 Percentages: N/A
dbaron@15119 358 Media: visual
dbaron@15119 359 Computed value: see below
dbaron@15119 360 Animatable: no
dbaron@15119 361 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
dbaron@15119 362 </pre>
dbaron@7811 363
dbaron@7814 364 <p>
dbaron@7814 365 The 'overflow' property is a shorthand property
dbaron@7814 366 that sets the specified values of both 'overflow-x' and 'overflow-y'
dbaron@7814 367 to the value specified for 'overflow'.
dbaron@7814 368 </p>
dbaron@7814 369
dbaron@15119 370 <pre class=propdef>
dbaron@15119 371 Name: overflow
florian@15497 372 Value: ''visible'' | ''hidden'' | ''clip'' | ''scroll'' | ''auto''
dbaron@15119 373 Initial: see individual properties
dbaron@15119 374 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
dbaron@15119 375 Inherited: no
dbaron@15119 376 Percentages: N/A
dbaron@15119 377 Media: visual
dbaron@15119 378 Computed value: see individual properties
dbaron@15119 379 Animatable: no
dbaron@15119 380 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
dbaron@15119 381 </pre>
dbaron@7811 382
florian@15277 383 <div id="overflow-computed-values">
florian@15277 384 <p>The computed values of 'overflow-x' and 'overflow-y'
florian@15277 385 are determined from the cascaded values [[!CSS3CASCADE]]
florian@15277 386 based on the following rules:</p>
florian@15277 387
florian@15277 388 <ol>
florian@15277 389 <li>
florian@15277 390 If one cascaded values is ''overflow/visible''
florian@15277 391 and the other is not,
florian@15277 392 then computed values are the cascaded values
florian@15277 393 with ''overflow/visible'' changed to ''overflow/auto''.
florian@15277 394 </li>
florian@15277 395 <li>
florian@15804 396 Otherwise, if both cascaded values are ''overflow/visible''
florian@15804 397 and the computed value of 'contain' is
florian@15804 398 one that activates <a>paint containment</a>
florian@15804 399 (e.g. ''contain:strict''
florian@15804 400 or ''contain: paint''
florian@15804 401 or ''contain: layout paint''…),
florian@15804 402 then the computed values of both 'overflow-x' and 'overflow-y'
florian@15804 403 are changed to ''overflow/clip''.</li>
florian@15804 404 <li>
florian@15277 405 Otherwise, the computed values are as specified.
florian@15277 406 </li>
florian@15277 407 </ol>
florian@15277 408 </div>
florian@15277 409
dbaron@7811 410 <p>The values of these properties are:</p>
dbaron@7811 411
jackalmage@15301 412 <dl dfn-for="overflow, overflow-x, overflow-y" dfn-type="value">
dbaron@7811 413 <dt><dfn>visible</dfn>
dbaron@7811 414 <dd>
dbaron@7811 415 There is no special handling of overflow, that is, it
dbaron@7811 416 may be rendered outside the block container.
dbaron@7811 417 </dd>
dbaron@7811 418 <dt><dfn>hidden</dfn>
git@18362 419 <dd>
git@18362 420 This value indicates that
git@18362 421 the box’s content is clipped to its padding box
git@18362 422 and that the UA must not provide any scrolling user interface
git@18362 423 to view the content outside the clipping region,
git@18362 424 nor allow scrolling by direct intervention of the user,
git@18362 425 such as dragging on a touch screen
git@18362 426 or using the scrolling wheel on a mouse.
git@18362 427 However, the content must still be scrollable programatically,
git@18362 428 for example using the mechanisms defined in [[CSSOM-VIEW]],
git@18362 429 and the box is therefore still a <a>scroll container</a>.
git@18362 430
florian@15497 431 <dt><dfn>clip</dfn>
florian@15496 432 <dd>Like ''hidden'',
florian@15496 433 this value indicates that
florian@15496 434 the content is clipped
florian@15496 435 and that no scrolling user interface should be provided by the UA
florian@15496 436 to view the content outside the clipping region.
florian@15496 437 In addition, unlike ''overflow: hidden''
florian@15496 438 which still allows programmatic scrolling,
florian@15497 439 ''overflow: clip'' forbids scrolling entirely,
florian@15496 440 through any mechanism.
jackalmage@15674 441
florian@15496 442 Issue: Mozilla implements -moz-hidden-unscrollable,
florian@15497 443 which is similar to ''clip'',
florian@15496 444 except that it does not cause the element to establish a BFC.
florian@15496 445 Should we match that?
dbaron@7811 446 <dt><dfn>scroll</dfn>
florian@15496 447 <dd>This value indicates that the content is clipped
florian@15496 448 and that if the user agent uses a scrolling mechanism
florian@15496 449 that is visible on the screen (such as a scroll bar or a panner),
florian@15496 450 that mechanism should be displayed for a box
florian@15496 451 whether or not any of its content is clipped.
florian@15496 452 This avoids any problem with scrollbars appearing
florian@15496 453 and disappearing in a dynamic environment.
florian@15496 454 When this value is specified and the target medium is ''print'',
jackalmage@15674 455 overflowing content may be printed.
dbaron@7811 456 <dt><dfn>auto</dfn>
florian@15496 457 <dd>The behavior of the ''overflow/auto'' value is user agent-dependent,
jackalmage@15674 458 but should cause a scrolling mechanism to be provided for overflowing boxes.
florian@15277 459 </dl>
florian@15277 460
florian@15496 461 Even if 'overflow' is set to ''overflow/visible'',
jackalmage@15674 462 content may be clipped to a UA's document window by the native operating environment.
florian@15496 463
florian@15496 464 If the computed value of 'overflow' is not ''overflow/visible'',
florian@15496 465 the element creates a block formatting context.
florian@15496 466
florian@15496 467 UAs must apply the 'overflow' property
florian@15496 468 set on the root element to the viewport.
florian@15496 469 HTML UAs must instead apply the ‘overflow’ property
florian@15496 470 from the <{body}> element to the viewport
florian@15496 471 if the value on the root element is ''visible''.
florian@15496 472 The ''visible'' value when used for the viewport
florian@15496 473 must be interpreted as ''overflow/auto''.
florian@15496 474 The element from which the value is propagated
florian@15496 475 must have a used value for 'overflow' of ''visible''.
florian@15496 476
florian@15496 477 In the case of a scrollbar being placed on an edge of the element's box,
florian@15496 478 it should be inserted between the inner border edge
florian@15496 479 and the outer padding edge.
florian@15496 480 Any space taken up by the scrollbars should be
florian@15496 481 taken out of (subtracted from the dimensions of)
jackalmage@15674 482 the containing block formed by the element with the scrollbars.
florian@15496 483
florian@15496 484 Issue: import examples from [[CSS3-BOX]].
florian@15496 485
florian@15277 486 <p class="issue">
florian@15277 487 Explain which directions allow scrolling and which don't,
florian@15277 488 as a function of 'direction'
florian@15277 489 (including propagation of 'direction' to the ICB).
florian@15277 490 </p>
florian@15277 491
florian@15277 492
florian@15277 493 <p class="issue">
florian@15277 494 [[CSS3-MARQUEE]] describes an 'overflow-style' property,
florian@15277 495 but it has not picked up implementation experience
florian@15277 496 that the working group is aware of.
florian@15277 497 Should this document treat 'overflow-style' as a defunct proposal,
florian@15277 498 or should this document describe the 'overflow-style' property
florian@15277 499 and attempt to revive it,
florian@15277 500 despite that implementations have implemented
florian@15277 501 'overflow-x' and 'overflow-y' instead?
florian@15277 502 </p>
florian@15277 503
florian@15278 504 <h2 id="fragmentation">Fragmentation of overflow</h2>
florian@15277 505
florian@15279 506 The 'continue' property gives authors the ability
florian@15279 507 to request that content that does not fit inside an element
florian@15279 508 be fragmented (in the sense of [[!CSS3-BREAK]]),
florian@15279 509 and provides alternatives
florian@15279 510 for where the remaining content should continue.
florian@15279 511
florian@15279 512 Notably, this property explains traditional pagination,
florian@15279 513 and extends it further.
florian@15279 514
florian@15278 515 <pre class=propdef>
florian@15278 516 Name: continue
jackalmage@15301 517 Value: ''auto'' | ''overflow'' | ''paginate'' | ''fragments'' | ''discard''
florian@15293 518 Initial: auto
florian@15278 519 Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]]
florian@15278 520 Inherited: no
florian@15278 521 Percentages: N/A
florian@15278 522 Media: visual
florian@15278 523 Computed value: see below
florian@15278 524 Animatable: no
florian@15278 525 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
florian@15278 526 </pre>
florian@15277 527
florian@15282 528 Issue: The naming of this property and its values is preliminary.
florian@15282 529 This was initially proposed as
florian@15282 530 "fragmentation: auto | none | break | clone | page"
florian@15282 531 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 532 and there is not yet wide agreement as to which naming is better.
florian@15277 533
florian@15284 534 Issue: This property is meant to generalize and replace 'region-fragment'.
florian@15284 535 Once it is sufficiently stable in this specification,
florian@15284 536 'region-fragment' should be removed from the regions specification in favor of this.
florian@15284 537
florian@15278 538 Note: ''continue: fragments'' replaces "overflow:fragments"
florian@15278 539 from earlier versions of this specification,
florian@15278 540 while ''continue: paginate'' replaces "overflow: paged-x | paged-y | paged-x-controls | paged-y-controls"
florian@15277 541
florian@15278 542 <dl dfn-for="continue" dfn-type="value">
florian@15293 543 <dt><dfn>auto</dfn>
florian@15293 544 <dd>''continue/auto'' may only occur as a computed value
florian@15279 545 if the element is a <a spec="css-regions">CSS Region</a>
florian@15293 546 other than the last one in a <a spec="css-regions">region chain</a>.
florian@15293 547 Content that doesn't fit is pushed to the next region of the chain.
florian@15293 548
florian@15293 549 In all other cases, ''continue/auto'' computes to one of the other values.
florian@15278 550
florian@15278 551 <dt><dfn>overflow</dfn>
florian@15278 552 <dd>Content that doesn't fit overflows, according to the 'overflow' property
florian@15278 553
florian@15278 554 <dt><dfn>discard</dfn>
florian@15278 555 <dd>Content that doesn't fit is discarded at a fragmentation break
florian@15278 556
florian@15278 557 Note: generalized from region-fragment: break; on the last region of a region chain
florian@15278 558
florian@15279 559 Issue: When the element isn't a <a spec="css-break">fragmentation container</a> already,
florian@15279 560 should this work by turning it directly into one,
florian@15279 561 or by creating a <a>fragment box</a> inside it like ''continue/fragments'' does?
florian@15278 562
florian@15278 563 <dt><dfn>paginate</dfn>
florian@15278 564 <dd>Content that doesn't fit paginates.
florian@15278 565 This creates a paginated view inside the element
florian@15278 566 similar to the way that 'overflow: scroll' creates a scrollable view.
florian@15278 567
florian@15279 568 See <a href="#paginated-overflow">paginated overflow</a>
florian@15278 569
florian@15278 570 Note: Print is effectively "continue: paginate" on the root.
dbaron@7811 571 <dt><dfn>fragments</dfn>
florian@15278 572 <dd>content that doesn't fit causes the element to copy itself and continue laying out.
florian@15279 573
florian@15278 574 See <a href="#fragment-overflow">fragment overflow</a>.
dbaron@7811 575 </dl>
dbaron@7811 576
florian@15279 577 The computed value of the 'continue' for a given element or pseudo element is determined as follow:
florian@15279 578 <ol>
florian@15293 579 <li>If the specified value is ''continue/auto''
florian@15279 580 <ol>
florian@15279 581 <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 582 the computed value is ''continue/auto''
florian@15279 583 <li>On a page
florian@15279 584 the computed value is ''continue/paginate''
florian@15279 585 <li>On a <a>fragment box</a>
florian@15279 586 the computed value is ''continue/fragments''
florian@15283 587 <li>Otherwise, the computed value is ''continue/overflow''
florian@15279 588 </ol>
florian@15279 589 <li>If the specified value is ''continue/framgents''
florian@15279 590 <ol>
florian@15279 591 <li>On a page
florian@15279 592 the computed value is ''continue/paginate''
florian@15279 593 <li>Otherwise, the computed value is the specified value
florian@15279 594 </ol>
florian@15279 595 <li>In all other cases, the computed value is the specified value
florian@15279 596 </ol>
florian@15279 597
florian@15280 598 Issue: If we introduce a pseudo element that can select columns in a multicol,
florian@15293 599 we would need to specify that auto computes to auto on it,
florian@15293 600 or introduce a new value and have auto compute to that
florian@15280 601 (but what would that value compute to on things that aren't columns?).
florian@15280 602
florian@15278 603 Note: For background discussions leading to this property, see these threads:
florian@15278 604 <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 605 <a href="https://lists.w3.org/Archives/Public/www-style/2015Jan/0357.html">proposal for a fragmentation property</a>
dbaron@14821 606
dbaron@6470 607 <h2 id="paginated-overflow">Paginated overflow</h2>
dbaron@6470 608
florian@15278 609 This section introduces and defines the meaning of the ''continue/paginate'' value of the 'continue' property.
dbaron@6470 610
florian@15278 611 Issue: Write this section
florian@15278 612
florian@15281 613 Issue: Pages should be possible to style with @page rules. How does that work for nested pages?
florian@15281 614
florian@15281 615 <div class="issue">
florian@15281 616 Should traditional pagination (e.g. when printing)
florian@15293 617 be expressed through some magic in the computed value of ''continue/auto'',
florian@15281 618 or by inserting this in the UA stylesheet:
florian@15281 619 <pre><code class="lang-css">
florian@15281 620 @media (overflow-block: paged), (overflow-block: optional-paged) {
florian@15281 621 :root {
florian@15281 622 continue: paginate;
florian@15281 623 }
florian@15281 624 }
florian@15281 625 </code></pre>
florian@15281 626 </div>
florian@15281 627
florian@15281 628 Issue: Traditional pagination (e.g. when printing) assumes that
florian@15281 629 :root is contained in the page box,
florian@15281 630 rather than having the page box be a pseudo element child of :root.
florian@15281 631 Can we work around that using something similar to fragment boxes?
florian@15281 632 Or maybe by having a fragment box (reproducing :root) inside a page box inside :root?
florian@15281 633
florian@15281 634 Issue: How does the page box model work when it is a child of a regular css box?
florian@15281 635
florian@15278 636 Issue: The initial proposal in [[CSS3GCPM]] and implemantation from Opera
florian@15278 637 used 4 values instead of ''continue/paginate'':
florian@15278 638 "paged-x | paged-y | paged-x-controls | paged-y-controls".
florian@15278 639 Should this property also include these values,
florian@15278 640 or are they better handled as separate properties?
florian@15278 641 (e.g.: "pagination-layout: auto | horizontal | vertical", "pagination-controls: auto | none")
florian@15278 642
florian@15278 643 Issue: Ability to display N pages at once
florian@15278 644 rather than just one page at once?
florian@15278 645 Could this be a value of "pagination-layout", such as:
florian@15278 646 "pagination-layout: horizontal 2;"
dbaron@6470 647
florian@15303 648 Issue: Brad Kemper has proposed a model for combining pagination and
florian@15303 649 fragment overflow, which also deals with displaying multiple pages.
florian@15303 650 <a href="http://www.w3.org/mid/[email protected]">http://www.w3.org/mid/[email protected]</a>
florian@15303 651
dbaron@6497 652 <p class="issue">
dbaron@6497 653 The current implementation of paginated overflow uses
dbaron@6497 654 the 'overflow'/'overflow-x'/'overflow-y' properties
dbaron@6497 655 rather than the 'overflow-style' property as proposed
dbaron@6497 656 in the [[CSS3GCPM]] draft
dbaron@6497 657 (which also matches the [[CSS3-MARQUEE]] proposal).
florian@15278 658 or the 'continue' property as described here.
dbaron@6497 659 </p>
dbaron@6497 660
dbaron@6484 661 <h2 id="fragment-overflow">Fragment overflow</h2>
dbaron@6470 662
florian@15278 663 This section introduces and defines the meaning of
florian@15278 664 the ''continue/fragments'' value of the 'continue' property.
dbaron@6470 665
dbaron@6470 666 <p>
florian@15278 667 When the computed value of 'continue' for an element is ''continue/fragments'',
dbaron@6470 668 and implementations would otherwise have created a box for the element,
dbaron@6491 669 then implementations must create a sequence of <dfn>fragment box</dfn>es
dbaron@6470 670 for that element.
florian@15278 671 (It is possible for an element with ''continue: fragments''
dbaron@15115 672 to generate only one <a>fragment box</a>.
florian@15278 673 However, if an element's computed 'continue' is not ''continue/fragments'',
dbaron@15115 674 then its box is not a <a>fragment box</a>.)
dbaron@15115 675 Every <a>fragment box</a> is a fragmentation container,
dbaron@6491 676 and any overflow
dbaron@6491 677 that would cause that fragmentation container to fragment
dbaron@15115 678 causes another <a>fragment box</a> created as a next sibling
dbaron@6470 679 of the previous one.
dbaron@6470 680 <span class="issue">Or is it as though it's a next sibling of
dbaron@6470 681 the element? Need to figure out exactly how this interacts with
dbaron@6470 682 other box-level fixup.</span>
dbaron@15115 683 Additionally, if the <a>fragment box</a> is also
dbaron@6492 684 a multi-column box (as defined in [[!CSS3COL]]
dbaron@6492 685 <span class="issue">though it defines <i>multi-column element</i></span>)
dbaron@15115 686 any content that would lead to the creation of <a>overflow columns</a> [[!CSS3COL]]
dbaron@6492 687 instead is flown into an additional fragment box.
dbaron@6491 688 However, fragment boxes may themselves be broken
dbaron@6491 689 (due to fragmentation in a fragmentation context outside of them,
dbaron@6491 690 such as pages, columns, or other fragment boxes);
dbaron@6491 691 such breaking leads to fragments of the same fragment box
dbaron@6491 692 rather than multiple fragment boxes.
dbaron@6491 693 (This matters because fragment boxes may be styled by their index;
dbaron@6491 694 such breaking leads to multiple fragments of a fragment box
dbaron@6491 695 with a single index.
dbaron@6491 696 This design choice is so that
dbaron@6491 697 breaking a fragment box across pages does not break
dbaron@6491 698 the association of indices to particular pieces of content.)
dbaron@6491 699 <span class="issue">Should a forced break that breaks to
dbaron@6491 700 an outer fragmentation context cause a new fragment of a single
dbaron@6491 701 fragment box or a new fragment box?</span>
dbaron@6491 702 <span class="issue">Should we find a term other than
dbaron@15115 703 <a>fragment box</a> here to make this a little less confusing?</span>
dbaron@6470 704 </p>
dbaron@6470 705
dbaron@6470 706 <p class="issue">
dbaron@6491 707 What if we want to be able to style the pieces of an element
dbaron@6491 708 split within another type of fragmentation context?
dbaron@6491 709 These rules prevent ever using ''::nth-fragment()'' for that,
dbaron@6491 710 despite that the name seems the most logical name for such a feature.
dbaron@6470 711 </p>
dbaron@6470 712
dbaron@6475 713 <div class="example">
dbaron@6477 714 <table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
dbaron@6475 715 &lt;title&gt;Breaking content into
dbaron@6475 716 equal-sized cards&lt;/title&gt;
dbaron@6475 717 &lt;style&gt;
dbaron@6475 718 .in-cards {
florian@15278 719 continue: fragments;
dbaron@6475 720
dbaron@6475 721 width: 13em;
dbaron@6475 722 height: 8em;
dbaron@6475 723
dbaron@6475 724 padding: 4px;
dbaron@6475 725 border: medium solid blue;
dbaron@6475 726 margin: 6px;
dbaron@6475 727
dbaron@6475 728 font: medium/1.3 Times New
dbaron@6475 729 Roman, Times, serif;
dbaron@6475 730 }
dbaron@6475 731 &lt;/style&gt;
dbaron@6475 732 &lt;div class="in-cards"&gt;
dbaron@6475 733 In this example, the text in the div
dbaron@6475 734 is broken into a series of cards.
dbaron@6475 735 These cards all have the same style.
dbaron@6475 736 The presence of enough content to
dbaron@6475 737 overflow one of the cards causes
dbaron@6475 738 another one to be created. The second
dbaron@6475 739 card is created just like it's the
dbaron@6475 740 next sibling of the first.
dbaron@6477 741 &lt;/div&gt;</pre></td><td>
dbaron@6475 742 <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 743 <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 744 </td></tr></table>
dbaron@6475 745 </div>
dbaron@6475 746
dbaron@6487 747 <p class="issue">
florian@15278 748 We should specify that ''continue: fragments'' does not apply
dbaron@6487 749 to at least some table parts,
dbaron@6487 750 and perhaps other elements as well.
dbaron@6487 751 We need to determine exactly which ones.
dbaron@6487 752 </p>
dbaron@6487 753
dbaron@6488 754 <p class="issue">
dbaron@6488 755 This specification needs to say which type of
dbaron@6488 756 fragmentation context is created
dbaron@15113 757 so that it's clear which values of the 'break-*' properties
dbaron@6488 758 cause breaks within this context.
dbaron@15113 759 We probably want ''break-*: region'' to apply.
dbaron@6488 760 </p>
dbaron@6488 761
dbaron@6494 762 <p class="issue">
dbaron@6494 763 This specification needs a processing model
dbaron@6494 764 that will apply in cases where the layout containing the
dbaron@6494 765 fragments has characteristics that use the intrinsic size of the fragments
dbaron@6494 766 to change the amount of space available for them,
dbaron@6494 767 such as [[CSS3-GRID-LAYOUT]].
dbaron@6494 768 There has already been some work on such a processing model
dbaron@6494 769 in [[CSS3-REGIONS]],
dbaron@6494 770 and the work done on a model there,
dbaron@6494 771 and the editors of that specification,
dbaron@6494 772 should inform what happens in this specification.
dbaron@6494 773 </p>
dbaron@6494 774
dbaron@6484 775 <h3 id="fragment-styling">Fragment styling</h3>
dbaron@6470 776
dbaron@6484 777 <h4 id="fragment-pseudo-element">The ::nth-fragment() pseudo-element</h4>
dbaron@6470 778
dbaron@6470 779 <p>
dbaron@15120 780 The <dfn selector>::nth-fragment()</dfn> pseudo-element
dbaron@15120 781 is a pseudo-element
dbaron@15115 782 that describes some of the <a>fragment box</a>es generated by an element.
dbaron@6470 783 The argument to the pseudo-element takes the same syntax
dbaron@6470 784 as the argument to the :nth-child() pseudo-class
dbaron@6470 785 defined in [[!SELECT]], and has the same meaning
dbaron@6470 786 except that the number is relative to
dbaron@15115 787 <a>fragment box</a>es generated by the element
dbaron@6470 788 instead of siblings of the element.
dbaron@6470 789 </p>
dbaron@6470 790
dbaron@6470 791 <p class="note">
dbaron@6484 792 Selectors that allow addressing fragments
dbaron@6470 793 by counting from the end rather than the start
dbaron@6470 794 are intentionally not provided.
dbaron@6470 795 Such selectors would interfere with determining
dbaron@6484 796 the number of fragments.
dbaron@6470 797 </p>
dbaron@6470 798
dbaron@6489 799 <p class="issue">
dbaron@6489 800 Depending on future discussions,
dbaron@6489 801 this ''::nth-fragment(<var>an+b</var>)'' syntax
dbaron@6489 802 may be replaced with
dbaron@6489 803 the new ''::fragment:nth(<var>an+b</var>)'' syntax.
dbaron@6489 804 </p>
dbaron@6489 805
dbaron@6484 806 <h4 id="style-of-fragments">Styling of fragments</h4>
dbaron@6470 807
dbaron@6470 808 <p class="issue">
florian@15278 809 Should this apply to continue:fragments only,
florian@15278 810 or also to continue:paginate?
dbaron@6470 811 (If it applies,
dbaron@6470 812 then stricter property restrictions would be needed
florian@15278 813 for continue:paginate.)
dbaron@6470 814 </p>
dbaron@6470 815
dbaron@6470 816 <p>
dbaron@6484 817 In the absence of rules with ''::nth-fragment()'' pseudo-elements,
dbaron@15115 818 the computed style for each <a>fragment box</a>
dbaron@6470 819 is the computed style for the element
dbaron@15115 820 for which the <a>fragment box</a> was created.
dbaron@15115 821 However, the style for a <a>fragment box</a> is also influenced
dbaron@15115 822 by rules whose selector's <a>subject</a> [[!SELECT]]
dbaron@6484 823 has an ''::nth-fragment()'' pseudo-element,
dbaron@15115 824 if the 1-based number of the <a>fragment box</a> matches
dbaron@6484 825 that ''::nth-fragment()'' pseudo-element
dbaron@6484 826 and the selector (excluding the ''::nth-fragment()'' pseudo-element)
dbaron@6484 827 matches the element generating the fragments.
dbaron@6470 828 </p>
dbaron@6470 829
dbaron@6486 830 <p>
dbaron@15115 831 When determining the style of the <a>fragment box</a>,
dbaron@6486 832 these rules that match the fragment pseudo-element
dbaron@6486 833 cascade together with the rules that match the element,
dbaron@6486 834 with the fragment pseudo-element adding the specificity
dbaron@6486 835 of a pseudo-class to the specificity calculation.
dbaron@6486 836 <span class="issue">Does this need to be specified in
dbaron@6486 837 the cascading module as well?</span>
dbaron@6486 838 </p>
dbaron@6486 839
dbaron@6477 840 <div class="example">
dbaron@6477 841 <table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
dbaron@6477 842 &lt;style&gt;
dbaron@6477 843 .bouncy-columns {
florian@15278 844 continue: fragments;
dbaron@6477 845 width: 6em;
dbaron@6477 846 height: 10em;
dbaron@6477 847 float: left;
dbaron@6477 848 margin: 1em;
dbaron@6477 849 font: medium/1.25 Times New
dbaron@6477 850 Roman, Times, serif;
dbaron@6477 851 }
dbaron@6484 852 .bouncy-columns::nth-fragment(1) {
dbaron@6477 853 background: aqua; color: black;
dbaron@6477 854 transform: rotate(-3deg);
dbaron@6477 855 }
dbaron@6484 856 .bouncy-columns::nth-fragment(2) {
dbaron@6477 857 background: yellow; color: black;
dbaron@6477 858 transform: rotate(3deg);
dbaron@6477 859 }
dbaron@6477 860 &lt;/style&gt;
dbaron@6477 861 &lt;div class="bouncy-columns"&gt;
dbaron@6477 862 <i>...</i>
dbaron@6477 863 &lt;/div&gt;</pre></td><td>
dbaron@6477 864 <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 865 <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 866 <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 867 </td></tr></table>
dbaron@6477 868 </div>
dbaron@6477 869
dbaron@6470 870 <p>
florian@15278 871 Styling an ''::nth-fragment()'' pseudo-element with the 'continue'
dbaron@6490 872 property does take effect;
dbaron@15115 873 if a <a>fragment box</a> has a
florian@15278 874 computed value of 'continue' other than ''fragments''
dbaron@6490 875 then that fragment box is the last fragment.
florian@15278 876 However, overriding 'continue' on the first fragment
dbaron@15115 877 does not cause the <a>fragment box</a> not to exist;
dbaron@6490 878 whether there are fragment boxes at all is determined by
dbaron@6490 879 the computed value of overflow for the element.
dbaron@6470 880 </p>
dbaron@6470 881
dbaron@6470 882 <p>
dbaron@6485 883 Styling an ''::nth-fragment()'' pseudo-element with the 'content'
dbaron@6485 884 property has no effect;
dbaron@6485 885 the computed value of 'content' for the fragment box
dbaron@6485 886 remains the same as the computed value of content for the element.
dbaron@6485 887 </p>
dbaron@6485 888
dbaron@6485 889 <p>
dbaron@15115 890 Specifying ''display: none'' for a <a>fragment box</a> causes
dbaron@6484 891 the fragment box with that index not to be generated.
dbaron@6470 892 However, in terms of the indices
dbaron@6484 893 used for matching ''::nth-fragment()'' pseudo-elements
dbaron@6484 894 of later fragment boxes,
dbaron@6470 895 it still counts as though it was generated.
dbaron@6470 896 However, since it is not generated, it does not contain any content.
dbaron@6470 897 </p>
dbaron@6470 898
dbaron@7813 899 <p>
dbaron@7813 900 Specifying other values of 'display', 'position',
dbaron@7813 901 or 'float' is permitted, but is not allowed to change
dbaron@7813 902 the computed value of 'display-inside'.
florian@15278 903 (Since 'continue' only
florian@15278 904 applies to block containers, flex containers, and grid containers
dbaron@7813 905 the computed value of 'display-inside' is always
dbaron@15115 906 ''display-inside/block'', ''display-inside/flex'', or
dbaron@15115 907 ''display-inside/grid''.
dbaron@7813 908 <span class="issue">Need to specify exactly how this works,
dbaron@7813 909 but it depends on
dbaron@7813 910 having 'display-inside' and 'display-outside' specified.</span>
dbaron@6470 911 </p>
dbaron@6470 912
dbaron@6470 913 <p>
dbaron@6470 914 To match the model for other pseudo-elements
dbaron@6470 915 where the pseudo-elements live inside their corresponding element,
dbaron@6484 916 declarations in ''::nth-fragment()'' pseudo-elements override
dbaron@6470 917 declarations in rules without the pseudo-element.
dbaron@6470 918 The relative priority within such declarations is determined
dbaron@6470 919 by normal cascading order (see [[!CSS21]]).
dbaron@6470 920 </p>
dbaron@6470 921
dbaron@6470 922 <p>
dbaron@6484 923 Styles specified on ''::nth-fragment()'' pseudo-elements
dbaron@15115 924 do affect inheritance to content within the <a>fragment box</a>.
dbaron@15115 925 In other words, the content within the <a>fragment box</a> must
dbaron@6484 926 inherit from the fragment box's style (i.e., the pseudo-element style)
dbaron@6470 927 rather than directly from the element.
dbaron@6484 928 This means that elements split between fragment boxes may
dbaron@6470 929 have different styles for different parts of the element.
dbaron@6470 930 </p>
dbaron@6470 931
dbaron@6472 932 <p class="issue">
dbaron@6472 933 This inheritance rule allows specifying styles indirectly
dbaron@6472 934 (by using explicit ''inherit'' or using default inheritance
dbaron@15117 935 on properties that don't apply to ''::first-letter'')
dbaron@6472 936 that can't be specified directly
dbaron@6472 937 (based on the rules in the next section).
dbaron@6472 938 This is a problem.
dbaron@6484 939 The restrictions that apply to styling inside fragments
dbaron@6484 940 should also apply to inheritance from fragments.
dbaron@6472 941 </p>
dbaron@6472 942
dbaron@6480 943 <div class="example">
dbaron@6480 944 <table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
dbaron@6480 945 &lt;style&gt;
dbaron@6480 946 .article {
florian@15278 947 continue: fragments;
dbaron@6480 948 }
dbaron@6484 949 .article::nth-fragment(1) {
dbaron@6480 950 font-size: 1.5em;
dbaron@6480 951 margin-bottom: 1em;
dbaron@6480 952 height: 4em;
dbaron@6480 953 }
dbaron@6491 954 .article::nth-fragment(2) {
dbaron@6480 955 margin-left: 5em;
dbaron@6480 956 margin-right: 2em;
dbaron@6480 957 }
dbaron@6480 958 &lt;/style&gt;
dbaron@6480 959 &lt;div class="article"&gt;
dbaron@6480 960 The &lt;code&gt;font-size&lt;/code&gt; property<i>...</i>
dbaron@6480 961 &lt;/div&gt;</pre></td><td>
dbaron@6484 962 <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 963 <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 964 </td></tr></table>
dbaron@6480 965 </div>
dbaron@6478 966
dbaron@6484 967 <h4 id="style-in-fragments">Styling inside fragments</h4>
dbaron@6470 968
dbaron@6470 969 <p class="issue">
florian@15278 970 Should this apply to continue:fragments only,
florian@15278 971 or also to continue:paginate?
dbaron@6470 972 </p>
dbaron@6470 973
dbaron@6470 974 <p>
dbaron@6484 975 The ''::nth-fragment()'' pseudo-element
dbaron@6470 976 can also be used to style
dbaron@15115 977 content inside of a <a>fragment box</a>.
dbaron@6470 978 Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements,
dbaron@6484 979 the ''::nth-fragment()'' pseudo-element can be applied
dbaron@6470 980 to parts of the selector other than the subject:
dbaron@6470 981 in particular, it can match ancestors of the subject.
dbaron@6470 982 However, the only CSS properties applied
dbaron@6470 983 by rules with such selectors
dbaron@6470 984 are those that apply
dbaron@6470 985 to the ''::first-letter'' pseudo-element.
dbaron@6470 986 </p>
dbaron@6470 987
dbaron@6470 988 <p>
dbaron@6470 989 To be more precise,
dbaron@6484 990 when a rule's selector has ''::nth-fragment()'' pseudo-elements
dbaron@6470 991 attached to parts of the selector other than the subject,
dbaron@6470 992 the declarations in that rule apply to
dbaron@6470 993 a fragment (or pseudo-element thereof) when:
dbaron@6470 994 </p>
dbaron@6470 995 <ol>
dbaron@6470 996 <li>
dbaron@6470 997 the declarations are for properties that apply to the
dbaron@6470 998 ''::first-letter'' pseudo-element,
dbaron@6470 999 </li>
dbaron@6470 1000 <li>
dbaron@6470 1001 the declarations would apply to
dbaron@6470 1002 that fragment (or pseudo-element thereof)
dbaron@6484 1003 had those ''::nth-fragment()'' pseudo-elements been removed,
dbaron@6470 1004 with a particular association between
dbaron@6470 1005 each sequence of simple selectors and the element it matched,
dbaron@6470 1006 and
dbaron@6470 1007 </li>
dbaron@6470 1008 <li>
dbaron@6484 1009 for each removed ''::nth-fragment()'' pseudo-element,
dbaron@15115 1010 the fragment lives within a <a>fragment box</a>
dbaron@6470 1011 of the element associated in that association
dbaron@6470 1012 with the selector that the pseudo-element was attached to,
dbaron@6470 1013 and whose index matches the pseudo-element.
dbaron@6470 1014 </li>
dbaron@6470 1015 </ol>
dbaron@6470 1016
dbaron@6481 1017 <div class="example">
dbaron@6481 1018 <table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
dbaron@6481 1019 &lt;style&gt;
dbaron@6481 1020 .dark-columns {
florian@15278 1021 continue: fragments;
dbaron@6481 1022 width: 6em;
dbaron@6481 1023 height: 10em;
dbaron@6481 1024 float: left;
dbaron@6481 1025 margin-right: 1em;
dbaron@6481 1026 font: medium/1.25 Times New
dbaron@6481 1027 Roman, Times, serif;
dbaron@6481 1028 }
dbaron@6484 1029 .dark-columns::nth-fragment(1) {
dbaron@6481 1030 background: aqua; color: black;
dbaron@6481 1031 }
dbaron@6484 1032 .dark-columns::nth-fragment(1) :link {
dbaron@6481 1033 color: blue;
dbaron@6481 1034 }
dbaron@6484 1035 .dark-columns::nth-fragment(1) :visited {
dbaron@6481 1036 color: purple;
dbaron@6481 1037 }
dbaron@6484 1038 .dark-columns::nth-fragment(2) {
dbaron@6481 1039 background: navy; color: white;
dbaron@6481 1040 }
dbaron@6484 1041 .dark-columns::nth-fragment(2) :link {
dbaron@6481 1042 color: aqua;
dbaron@6481 1043 }
dbaron@6484 1044 .dark-columns::nth-fragment(2) :visited {
dbaron@6481 1045 color: fuchsia;
dbaron@6481 1046 }
dbaron@6481 1047 &lt;/style&gt;
dbaron@6481 1048 &lt;div class="dark-columns"&gt;
dbaron@6481 1049 <i>...</i>
dbaron@6481 1050 &lt;/div&gt;</pre></td><td>
dbaron@6484 1051 <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 1052 <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 1053 </td></tr></table>
dbaron@6481 1054 </div>
dbaron@6481 1055
dbaron@6478 1056
dbaron@6470 1057 <h3 id="max-lines">The 'max-lines' property</h3>
dbaron@6470 1058
dbaron@6470 1059 <p>
dbaron@6470 1060 Authors may wish to style the opening lines of an element
dbaron@6470 1061 with different styles
dbaron@6484 1062 by putting those opening lines in a separate fragment.
dbaron@6470 1063 However, since it may be difficult to predict the exact height
dbaron@6470 1064 occupied by those lines
dbaron@6484 1065 in order to restrict the first fragment to that height,
dbaron@6470 1066 this specification introduces a 'max-lines' property
dbaron@6484 1067 that forces a fragment to break
dbaron@6470 1068 after a specified number of lines.
dbaron@6470 1069 This forces a break after the given number of lines
dbaron@6470 1070 contained within the element or its descendants,
dbaron@6470 1071 as long as those lines are in the same block formatting context.
dbaron@6470 1072 </p>
dbaron@6470 1073
dbaron@15119 1074 <pre class=propdef>
dbaron@15119 1075 Name: max-lines
jackalmage@15301 1076 Value: ''none'' | ''&lt;integer>''
dbaron@15180 1077 Initial: ''none''
dbaron@15119 1078 Applies to: fragment boxes
dbaron@15119 1079 Inherited: no
peter@16989 1080 Animatable: as <a href="https://www.w3.org/TR/css3-transitions/#animatable-types">integer</a>
dbaron@15119 1081 Percentages: N/A
dbaron@15119 1082 Media: visual
dbaron@15119 1083 Computed value: specified value
dbaron@15119 1084 Canonical order: <abbr title="follows order of property value definition">per grammar</abbr>
dbaron@15119 1085 </pre>
dbaron@6470 1086
dbaron@15115 1087 <dl dfn-for="max-lines" dfn-type="value">
dbaron@15115 1088 <dt><dfn>none</dfn>
dbaron@6470 1089 <dd>
dbaron@6470 1090 <p>
dbaron@6470 1091 Breaks occur only as specified elsewhere.
dbaron@6470 1092 </p>
dbaron@6470 1093 </dd>
dbaron@6470 1094
dbaron@15181 1095 <dt><dfn><<integer>></dfn>
dbaron@6470 1096 <dd>
dbaron@6470 1097 <p>
dbaron@6470 1098 In addition to any breaks specified elsewhere,
dbaron@6470 1099 a break is forced before any line that would exceed
dbaron@6470 1100 the given number of lines
dbaron@6470 1101 being placed inside the element
dbaron@6470 1102 (excluding lines that are in
dbaron@6470 1103 a different block formatting context from
dbaron@6470 1104 the block formatting context to which
dbaron@6470 1105 an unstyled child of the element would belong).
dbaron@6470 1106 </p>
dbaron@6470 1107
dbaron@6470 1108 <p class="issue">
dbaron@6470 1109 If there are multiple boundaries between this line
dbaron@6470 1110 and the previous, where exactly (in terms of element
dbaron@6470 1111 boundaries) is the break forced?
dbaron@6470 1112 </p>
dbaron@6470 1113
dbaron@6470 1114 <p>
dbaron@6470 1115 Only positive integers are accepted.
dbaron@6470 1116 Zero or negative integers are a parse error.
dbaron@6470 1117 </p>
dbaron@6470 1118 </dd>
dbaron@6470 1119 </dl>
dbaron@6470 1120
dbaron@6484 1121 <p class="issue">Should this apply to fragment overflow only, or also
florian@15296 1122 to pagination?
florian@15296 1123 Given what we're doing with the continue property,
florian@15296 1124 it should actually apply to any fragmentainer.</p>
florian@15296 1125
florian@15296 1126 Issue: having max-lines do nothing on regular elements is not ideal.
florian@15296 1127 When applied to non fragmentainers,
florian@15296 1128 it should probably cause 'continue' to compute to ''continue/discard''
florian@15296 1129 so that you only need to reach for one property rather than 2 to get
florian@15296 1130 that effect.
dbaron@6470 1131
dbaron@6479 1132 <div class="example">
dbaron@6479 1133 <table class="source-demo-pair"><tr><td><pre>&lt;!DOCTYPE HTML&gt;
dbaron@6479 1134 &lt;style&gt;
dbaron@6479 1135 .article {
florian@15278 1136 continue: fragments;
dbaron@6479 1137 }
dbaron@6479 1138 .article::first-letter {
dbaron@6479 1139 font-size: 2em;
dbaron@6479 1140 line-height: 0.9;
dbaron@6479 1141 }
dbaron@6484 1142 .article::nth-fragment(1) {
dbaron@6479 1143 font-size: 1.5em;
dbaron@6479 1144 max-lines: 3;
dbaron@6479 1145 }
dbaron@6491 1146 .article::nth-fragment(2) {
dbaron@6479 1147 column-count: 2;
dbaron@6479 1148 }
dbaron@6479 1149 &lt;/style&gt;
dbaron@6479 1150 &lt;div class="article"&gt;
dbaron@6479 1151 <i>...</i>
dbaron@6479 1152 &lt;/div&gt;</pre></td><td>
dbaron@6479 1153 <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 1154 <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 1155 <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 1156 </td></tr></table>
dbaron@6479 1157 </div>
dbaron@6478 1158
dbaron@6493 1159 <h2 id="static-media">Overflow in static media</h2>
dbaron@6493 1160
dbaron@6493 1161 <p class="issue">
dbaron@6493 1162 This specification should define useful behavior
florian@15278 1163 for all values of 'overflow' and 'continue'
dbaron@6493 1164 in static media (such as print).
dbaron@6493 1165 Current implementation behavior is quite poor and
dbaron@6493 1166 produces unexpected results when authors have not considered
dbaron@6493 1167 what will happen when
dbaron@6493 1168 the content they produce for interactive media
dbaron@6493 1169 is printed.
dbaron@6493 1170 </p>
dbaron@6493 1171
dbaron@6470 1172 <h2 class=no-num id="acknowledgments">
dbaron@6470 1173 Acknowledgments</h2>
dbaron@6470 1174
dbaron@6470 1175 <p>
dbaron@6470 1176 Thanks especially to the feedback from
dbaron@6496 1177 Rossen Atanassov,
dbaron@6496 1178 Bert Bos,
dbaron@6496 1179 Tantek Çelik,
dbaron@6496 1180 John Daggett,
dbaron@6496 1181 fantasai,
dbaron@6496 1182 Daniel Glazman,
dbaron@6496 1183 Vincent Hardy,
dbaron@6470 1184 H&aring;kon Wium Lie,
dbaron@6496 1185 Peter Linss,
dbaron@7815 1186 Robert O'Callahan,
dbaron@6470 1187 Florian Rivoal,
dbaron@6473 1188 Alan Stearns,
dbaron@6496 1189 Steve Zilles,
dbaron@6470 1190 and all the rest of the
dbaron@6470 1191 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.
dbaron@6470 1192 </p>

mercurial