css-overflow/Overview.bs

Thu, 19 Mar 2015 11:11:56 +0100

author
Florian Rivoal <[email protected]>
date
Thu, 19 Mar 2015 11:11:56 +0100
changeset 15303
b39162d7d5d3
parent 15301
3c0a5f014a83
child 15315
6a444ec1c8e6
permissions
-rw-r--r--

[css-overflow] Log issue about proposed model combining pages and fragment overflow

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

mercurial