dbaron@15115:
dbaron@15115: Status: ED dbaron@15115: ED: http://dev.w3.org/csswg/css-overflow/ dbaron@15115: Shortname: css-overflow dbaron@15115: Group: csswg dbaron@15115: Level: 1 dbaron@15115: TR: http://www.w3.org/TR/css-overflow-3/ dbaron@15115: Previous version: http://www.w3.org/TR/2013/WD-css-overflow-3-20130418/ dbaron@15115: Editor: L. David Baron, Mozilla, http://dbaron.org/ dbaron@15115: 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: Status Text: The following features are at risk: … dbaron@15125: !Change Log: from 27 January 2015 to the present dbaron@15125: !Change Log: from 28 March 2013 to 27 January 2015 dbaron@15125: !Change Log: from 31 July 2012 to 27 March 2013 dbaron@15115:dbaron@15118: dbaron@15118: dbaron@15118: dbaron@15118: dbaron@15181: dbaron@15181: dbaron@15115:
dbaron@15115: spec:css-transforms-1; type:property; text:transform-style dbaron@15115:dbaron@15115: dbaron@15115:
dbaron@15115: url: http://www.w3.org/TR/2008/CR-css3-marquee-20081205/#the-overflow-style; type: property; text: overflow-style; dbaron@15115: url: http://dev.w3.org/csswg/css-break/#breaking-controls; type: property; text: break-*; dbaron@15115: url: http://dev.w3.org/csswg/css-multicol/#overflow-columns; type: dfn; text: overflow columns; dbaron@15115: url: http://dev.w3.org/csswg/selectors-3/#subject; type: dfn; text: subject; dbaron@15115:dbaron@6475: dbaron@6470: dbaron@6470:
dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: In CSS Level 1 [[CSS1]], placing more content than would fit dbaron@6470: inside an element with a specified size dbaron@6470: was generally an authoring error. dbaron@6470: Doing so caused the content to extend dbaron@6470: outside the bounds of the element, dbaron@6470: which would likely cause dbaron@6470: that content to overlap with other elements. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: CSS Level 2 [[CSS21]] introduced the 'overflow' property, dbaron@6470: which allows authors to have overflow be handled by scrolling, dbaron@6470: which means it is no longer an authoring error. dbaron@6470: It also allows authors to specify dbaron@6470: that overflow is handled by clipping, dbaron@6470: which makes sense when the author's intent dbaron@6470: is that the content not be shown. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: However, scrolling is not the only way dbaron@6470: to present large amounts of content, dbaron@6470: and may even not be the optimal way. dbaron@6470: After all, the codex replaced the scroll dbaron@6470: as the common format for large written works dbaron@6470: because of its advantages. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: This specification introduces dbaron@6470: a mechanism for Web pages to specify dbaron@6484: that an element of a page should handle overflow dbaron@6470: through pagination rather than through scrolling. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: This specification also extends the concept of overflow dbaron@6470: in another direction. dbaron@6484: Instead of requiring that authors specify a single area dbaron@6470: into which the content of an element must flow, dbaron@6484: this specification allows authors to specify multiple fragments, dbaron@6470: each with their own dimensions and styles, dbaron@6470: so that the content of the element can flow from one to the next, dbaron@6470: using as many as needed to place the content without overflowing. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: In both of these cases, implementations must dbaron@6470: break the content in the block-progression dimension. dbaron@6470: Implementations must do this is described dbaron@6470: in the CSS Fragmentation Module [[!CSS3-BREAK]]. dbaron@6470:
dbaron@6470: dbaron@9850:dbaron@9850: CSS uses the term overflow to describe dbaron@9850: the contents of a box dbaron@9850: that extend outside that one of that box's edges dbaron@9850: (i.e., its content edge, padding edge, dbaron@9850: border edge, or margin edge). dbaron@9850: The overflow might be described as the elements or features dbaron@9850: that cause this overflow, dbaron@9850: the non-rectangular region occupied by these features, dbaron@9850: or, more commonly, dbaron@9850: as the minimal rectangle that bounds that region. dbaron@9850: A box's overflow is computed based on the boxes and styles dbaron@9850: of the box and of all its descendants whose containing block chain dbaron@9850: undefined term? dbaron@9850: includes the box. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: In most cases, any of these types of overflow dbaron@9850: can be computed for any box dbaron@9850: from the bounds and properties of that box, dbaron@9850: and from the overflow (of that type) dbaron@9850: of each of its children. dbaron@9850: However, this is not always the case; for example, dbaron@9850: when ''transform-style: preserve-3d'' [[CSS3-TRANSFORMS]] is used on dbaron@9850: some of the children, their descendants with dbaron@9850: ''transform-style: preserve-3d'' must also be examined. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@15115: The ink overflow of a box dbaron@9850: is the part of that box and its contents that dbaron@9850: creates a visual effect outside of dbaron@9850: the box's border box. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: Since some effects in CSS (for example, the blurs in dbaron@9850: 'text-shadow' [[CSS3TEXT]] and 'box-shadow' [[CSS3BG]]) dbaron@9850: do not define what visual extent they cover, the extent dbaron@15115: of the ink overflow is undefined. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: Should we try to define it at all and just leave pieces undefined? dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: The ink overflow region is the non-rectangular region dbaron@15115: occupied by the ink overflow, and the dbaron@9850: ink overflow rectangle is dbaron@9850: the minimal rectangle whose axis is aligned to the box's axes dbaron@15115: and contains the ink overflow region. dbaron@15115: Note that the ink overflow rectangle is a rectangle dbaron@9850: in the box's coordinate system, but might be non-rectangular dbaron@9850: in other coordinate systems due to transforms [[CSS3-TRANSFORMS]]. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@15115: The scrollable overflow of a box is the dbaron@9850: set of things extending outside of that box's padding edge dbaron@9850: for which a scrolling mechanism needs to be provided. dbaron@9850:
dbaron@9850: dbaron@9865:dbaron@9865: The following definition should be rewritten to use dbaron@9865: the concept of 3D rendering context [[!CSS3-TRANSFORMS]] dbaron@9865: and related terms, dbaron@9865: particularly once those concepts stabilize following changes dbaron@9865: proposed in the CSS WG meeting on the morning of 2014-01-28. dbaron@9865:
dbaron@9865: dbaron@9850:dbaron@9850: Given the following definitions dbaron@9850: which belong in [[CSS3-TRANSFORMS]]: dbaron@9850:
dbaron@9850: dbaron@9850:The scrollable overflow of a box is the union of the following things, dbaron@9850: all adjusted for transforms undefined concept! into the box's coordinate space:
dbaron@9850: dbaron@9850:dbaron@9850: I wrote this definition off the top of my head, dbaron@9850: so it can't possibly be right. dbaron@9850: It's missing tons of pieces! dbaron@9850:
dbaron@9850: dbaron@9966:dbaron@9966: The handling of preserve-3d subtrees here is probably wrong; dbaron@9966: the elements should probably count dbaron@9966: only towards the overflow of the element that flattens them. dbaron@9966:
dbaron@9966: dbaron@9850:dbaron@9850: The scrollable overflow region is the non-rectangular region dbaron@15115: occupied by the scrollable overflow, and the dbaron@9850: scrollable overflow rectangle is dbaron@9850: the minimal rectangle whose axis is aligned to the box's axes dbaron@15115: and contains the scrollable overflow region. dbaron@15115: Note that the scrollable overflow rectangle is a rectangle dbaron@9850: in the box's coordinate system, but might be non-rectangular dbaron@9850: in other coordinate systems due to transforms [[CSS3-TRANSFORMS]]. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: This concept has been proposed for some uses, such as for dbaron@9850: determining what the 'outline' property goes around, and dbaron@9850: as the basis of a coordinate system for specifying clips and masks, dbaron@9850: but it's not clear if it's needed. dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: The border-box overflow of a box is the dbaron@9850: union of the box's border edge and the border edges of dbaron@9850: the box's descendants.
dbaron@9850: dbaron@9850: dbaron@9850:dbaron@9850: If needed, define more formally, as for scrollable overflow above. dbaron@9850: (Maybe even share the definitions in an appropriate way!) dbaron@9850:
dbaron@9850: dbaron@9850:dbaron@9850: The border-box overflow region is the non-rectangular region dbaron@15115: occupied by the border-box overflow, and the dbaron@9850: border-box overflow rectangle is dbaron@9850: the minimal rectangle whose axis is aligned to the box's axes dbaron@15115: and contains the border-box overflow region. dbaron@15115: Note that the border-box overflow rectangle is a rectangle dbaron@9850: in the box's coordinate system, but might be non-rectangular dbaron@9850: in other coordinate systems due to transforms [[CSS3-TRANSFORMS]]. dbaron@9850:
dbaron@9850: dbaron@7811:dbaron@15114: The 'overflow-x' property specifies dbaron@7814: the handling of overflow in the horizontal direction dbaron@7814: (i.e., overflow from the left and right sides of the box), dbaron@15114: and the 'overflow-y' property specifies the handling dbaron@7814: of overflow in the vertical direction dbaron@7814: (i.e., overflow from the top and bottom sides of the box) dbaron@7814:
dbaron@7814: dbaron@15119:dbaron@15119: Name: overflow-x, overflow-y dbaron@15180: Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments'' dbaron@15180: Initial: ''visible'' dbaron@15119: Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]] dbaron@15119: Inherited: no dbaron@15119: Percentages: N/A dbaron@15119: Media: visual dbaron@15119: Computed value: see below dbaron@15119: Animatable: no dbaron@15119: Canonical order: per grammar dbaron@15119:dbaron@7811: dbaron@7814:
dbaron@7814: The 'overflow' property is a shorthand property dbaron@7814: that sets the specified values of both 'overflow-x' and 'overflow-y' dbaron@7814: to the value specified for 'overflow'. dbaron@7814:
dbaron@7814: dbaron@15119:dbaron@15119: Name: overflow dbaron@15180: Value: ''visible'' | ''hidden'' | ''scroll'' | ''auto'' | ''paged-x'' | ''paged-y'' | ''paged-x-controls'' | ''paged-y-controls'' | ''fragments'' dbaron@15119: Initial: see individual properties dbaron@15119: Applies to: block containers [[!CSS21]], flex containers [[!CSS3-FLEXBOX]], and grid containers [[!CSS3-GRID-LAYOUT]] dbaron@15119: Inherited: no dbaron@15119: Percentages: N/A dbaron@15119: Media: visual dbaron@15119: Computed value: see individual properties dbaron@15119: Animatable: no dbaron@15119: Canonical order: per grammar dbaron@15119:dbaron@7811: dbaron@7811:
The values of these properties are:
dbaron@7811: dbaron@15115:The computed values of 'overflow-x' and 'overflow-y' dbaron@7811: are determined from the cascaded values [[!CSS3CASCADE]] dbaron@7811: based on the following rules:
dbaron@7811: dbaron@7811:dbaron@7811: Are all 4 of the ''paged-*'' values really needed? dbaron@7811:
dbaron@7811: dbaron@7811:dbaron@15115: When the fragmenting values are used, dbaron@7811: the overflow from the fragments themselves dbaron@15115: treats the fragmenting value as ''overflow/hidden''. dbaron@7811: Is this the right behavior? dbaron@7811: Give example. dbaron@7811:
dbaron@7811: dbaron@7820:dbaron@7820: [[CSS3-MARQUEE]] describes an 'overflow-style' property, dbaron@7820: but it has not picked up implementation experience dbaron@7820: that the working group is aware of. dbaron@7820: Should this document treat 'overflow-style' as a defunct proposal, dbaron@7820: or should this document describe the 'overflow-style' property dbaron@7820: and attempt to revive it, dbaron@7820: despite that implementations have implemented dbaron@7820: 'overflow-x' and 'overflow-y' instead? dbaron@7820:
dbaron@7820: dbaron@7916:dbaron@7916: There are discussions dbaron@7916: about how overflow, overflow-style, overflow-x and overflow-y dbaron@7916: should work and interact with each other. dbaron@7916: Until consensus on this topic is reached, dbaron@7916: it is not completely clear which of these dbaron@7916: should be used for dbaron@7916: paged-x | paged-y | paged-x-controls | paged-y-controls | fragments dbaron@7916:
dbaron@7916: dbaron@6483:dbaron@6483: Move material from [[CSS21]] and [[CSS3BOX]] here. dbaron@6483:
dbaron@6470: dbaron@14821:dbaron@14821: Explain which directions allow scrolling and which don't, dbaron@14821: as a function of 'direction' dbaron@14821: (including propagation of 'direction' to the ICB). dbaron@14821:
dbaron@14821: dbaron@6470:overflow:paginate or overflow:pages (or paged-x, paged-y, paged-x-controls, paged-y-controls as [[CSS3GCPM]] has?)
dbaron@6470: dbaron@6470:Ability to display N pages at once dbaron@6470: rather than just one page at once?
dbaron@6470: dbaron@6497:dbaron@6497: The current implementation of paginated overflow uses dbaron@6497: the 'overflow'/'overflow-x'/'overflow-y' properties dbaron@6497: rather than the 'overflow-style' property as proposed dbaron@6497: in the [[CSS3GCPM]] draft dbaron@6497: (which also matches the [[CSS3-MARQUEE]] proposal). dbaron@6497: We should probably switch away from 'overflow-style', dbaron@6497: but that's not 100% clear. dbaron@6497:
dbaron@6497: dbaron@6484:dbaron@6470: This section introduces and defines the meaning of dbaron@6484: the new ''fragments'' value of the 'overflow' property. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6484: When the computed value of 'overflow' for an element is ''fragments'', dbaron@6470: and implementations would otherwise have created a box for the element, dbaron@6491: then implementations must create a sequence of fragment boxes dbaron@6470: for that element. dbaron@6491: (It is possible for an element with ''overflow: fragments'' dbaron@15115: to generate only one fragment box. dbaron@6484: However, if an element's computed 'overflow' is not ''fragments'', dbaron@15115: then its box is not a fragment box.) dbaron@15115: Every fragment box is a fragmentation container, dbaron@6491: and any overflow dbaron@6491: that would cause that fragmentation container to fragment dbaron@15115: causes another fragment box created as a next sibling dbaron@6470: of the previous one. dbaron@6470: Or is it as though it's a next sibling of dbaron@6470: the element? Need to figure out exactly how this interacts with dbaron@6470: other box-level fixup. dbaron@15115: Additionally, if the fragment box is also dbaron@6492: a multi-column box (as defined in [[!CSS3COL]] dbaron@6492: though it defines multi-column element) dbaron@15115: any content that would lead to the creation of overflow columns [[!CSS3COL]] dbaron@6492: instead is flown into an additional fragment box. dbaron@6491: However, fragment boxes may themselves be broken dbaron@6491: (due to fragmentation in a fragmentation context outside of them, dbaron@6491: such as pages, columns, or other fragment boxes); dbaron@6491: such breaking leads to fragments of the same fragment box dbaron@6491: rather than multiple fragment boxes. dbaron@6491: (This matters because fragment boxes may be styled by their index; dbaron@6491: such breaking leads to multiple fragments of a fragment box dbaron@6491: with a single index. dbaron@6491: This design choice is so that dbaron@6491: breaking a fragment box across pages does not break dbaron@6491: the association of indices to particular pieces of content.) dbaron@6491: Should a forced break that breaks to dbaron@6491: an outer fragmentation context cause a new fragment of a single dbaron@6491: fragment box or a new fragment box? dbaron@6491: Should we find a term other than dbaron@15115: fragment box here to make this a little less confusing? dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6491: What if we want to be able to style the pieces of an element dbaron@6491: split within another type of fragmentation context? dbaron@6491: These rules prevent ever using ''::nth-fragment()'' for that, dbaron@6491: despite that the name seems the most logical name for such a feature. dbaron@6470:
dbaron@6470: dbaron@6475:<!DOCTYPE HTML> dbaron@6475: <title>Breaking content into dbaron@6475: equal-sized cards</title> dbaron@6475: <style> dbaron@6475: .in-cards { dbaron@6484: overflow: fragments; dbaron@6475: dbaron@6475: width: 13em; dbaron@6475: height: 8em; dbaron@6475: dbaron@6475: padding: 4px; dbaron@6475: border: medium solid blue; dbaron@6475: margin: 6px; dbaron@6475: dbaron@6475: font: medium/1.3 Times New dbaron@6475: Roman, Times, serif; dbaron@6475: } dbaron@6475: </style> dbaron@6475: <div class="in-cards"> dbaron@6475: In this example, the text in the div dbaron@6475: is broken into a series of cards. dbaron@6475: These cards all have the same style. dbaron@6475: The presence of enough content to dbaron@6475: overflow one of the cards causes dbaron@6475: another one to be created. The second dbaron@6475: card is created just like it's the dbaron@6475: next sibling of the first. dbaron@6477: </div> |
dbaron@6475: In this example, the text in the
dbaron@6475: div is broken into a series of cards. These cards all have the same style. The presence of enough content to overflow one of the cards causes another one to be created. The second
dbaron@6475: card is created just like it's the next sibling of the first. |
dbaron@6487: We should specify that ''overflow: fragments'' does not apply dbaron@6487: to at least some table parts, dbaron@6487: and perhaps other elements as well. dbaron@6487: We need to determine exactly which ones. dbaron@6487:
dbaron@6487: dbaron@6488:dbaron@6488: This specification needs to say which type of dbaron@6488: fragmentation context is created dbaron@15113: so that it's clear which values of the 'break-*' properties dbaron@6488: cause breaks within this context. dbaron@15113: We probably want ''break-*: region'' to apply. dbaron@6488:
dbaron@6488: dbaron@6494:dbaron@6494: This specification needs a processing model dbaron@6494: that will apply in cases where the layout containing the dbaron@6494: fragments has characteristics that use the intrinsic size of the fragments dbaron@6494: to change the amount of space available for them, dbaron@6494: such as [[CSS3-GRID-LAYOUT]]. dbaron@6494: There has already been some work on such a processing model dbaron@6494: in [[CSS3-REGIONS]], dbaron@6494: and the work done on a model there, dbaron@6494: and the editors of that specification, dbaron@6494: should inform what happens in this specification. dbaron@6494:
dbaron@6494: dbaron@6484:dbaron@15120: The ::nth-fragment() pseudo-element dbaron@15120: is a pseudo-element dbaron@15115: that describes some of the fragment boxes generated by an element. dbaron@6470: The argument to the pseudo-element takes the same syntax dbaron@6470: as the argument to the :nth-child() pseudo-class dbaron@6470: defined in [[!SELECT]], and has the same meaning dbaron@6470: except that the number is relative to dbaron@15115: fragment boxes generated by the element dbaron@6470: instead of siblings of the element. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6484: Selectors that allow addressing fragments dbaron@6470: by counting from the end rather than the start dbaron@6470: are intentionally not provided. dbaron@6470: Such selectors would interfere with determining dbaron@6484: the number of fragments. dbaron@6470:
dbaron@6470: dbaron@6489:dbaron@6489: Depending on future discussions, dbaron@6489: this ''::nth-fragment(an+b)'' syntax dbaron@6489: may be replaced with dbaron@6489: the new ''::fragment:nth(an+b)'' syntax. dbaron@6489:
dbaron@6489: dbaron@6484:dbaron@6484: Should this apply to fragment overflow only, dbaron@6470: or also to paginated overflow? dbaron@6470: (If it applies, dbaron@6470: then stricter property restrictions would be needed dbaron@6470: for paginated overflow.) dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6484: In the absence of rules with ''::nth-fragment()'' pseudo-elements, dbaron@15115: the computed style for each fragment box dbaron@6470: is the computed style for the element dbaron@15115: for which the fragment box was created. dbaron@15115: However, the style for a fragment box is also influenced dbaron@15115: by rules whose selector's subject [[!SELECT]] dbaron@6484: has an ''::nth-fragment()'' pseudo-element, dbaron@15115: if the 1-based number of the fragment box matches dbaron@6484: that ''::nth-fragment()'' pseudo-element dbaron@6484: and the selector (excluding the ''::nth-fragment()'' pseudo-element) dbaron@6484: matches the element generating the fragments. dbaron@6470:
dbaron@6470: dbaron@6486:dbaron@15115: When determining the style of the fragment box, dbaron@6486: these rules that match the fragment pseudo-element dbaron@6486: cascade together with the rules that match the element, dbaron@6486: with the fragment pseudo-element adding the specificity dbaron@6486: of a pseudo-class to the specificity calculation. dbaron@6486: Does this need to be specified in dbaron@6486: the cascading module as well? dbaron@6486:
dbaron@6486: dbaron@6477:<!DOCTYPE HTML> dbaron@6477: <style> dbaron@6477: .bouncy-columns { dbaron@6484: overflow: fragments; dbaron@6477: width: 6em; dbaron@6477: height: 10em; dbaron@6477: float: left; dbaron@6477: margin: 1em; dbaron@6477: font: medium/1.25 Times New dbaron@6477: Roman, Times, serif; dbaron@6477: } dbaron@6484: .bouncy-columns::nth-fragment(1) { dbaron@6477: background: aqua; color: black; dbaron@6477: transform: rotate(-3deg); dbaron@6477: } dbaron@6484: .bouncy-columns::nth-fragment(2) { dbaron@6477: background: yellow; color: black; dbaron@6477: transform: rotate(3deg); dbaron@6477: } dbaron@6477: </style> dbaron@6477: <div class="bouncy-columns"> dbaron@6477: ... dbaron@6477: </div> |
dbaron@6477: In this
dbaron@6477: example, the text in the div is broken into a series of columns. The author probably intended the
dbaron@6484: text to fill two columns. But if it happens to fill three columns, the third column is still created. It just doesn't
dbaron@6477: have any fragment-specific styling because the author didn't give it any. |
dbaron@6484: Styling an ''::nth-fragment()'' pseudo-element with the 'overflow' dbaron@6490: property does take effect; dbaron@15115: if a fragment box has a dbaron@6490: computed value of 'overflow' other than ''fragments'' dbaron@6490: then that fragment box is the last fragment. dbaron@15114: However, overriding 'overflow' on the first fragment dbaron@15115: does not cause the fragment box not to exist; dbaron@6490: whether there are fragment boxes at all is determined by dbaron@6490: the computed value of overflow for the element. dbaron@7813: Need to reword this to refer to the dbaron@15114: appropriate choice of 'overflow-x' or 'overflow-y', dbaron@7813: and then point to rule about the handling of the other one dbaron@15114: of 'overflow-x' or 'overflow-y'. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6485: Styling an ''::nth-fragment()'' pseudo-element with the 'content' dbaron@6485: property has no effect; dbaron@6485: the computed value of 'content' for the fragment box dbaron@6485: remains the same as the computed value of content for the element. dbaron@6485:
dbaron@6485: dbaron@6485:dbaron@15115: Specifying ''display: none'' for a fragment box causes dbaron@6484: the fragment box with that index not to be generated. dbaron@6470: However, in terms of the indices dbaron@6484: used for matching ''::nth-fragment()'' pseudo-elements dbaron@6484: of later fragment boxes, dbaron@6470: it still counts as though it was generated. dbaron@6470: However, since it is not generated, it does not contain any content. dbaron@6470:
dbaron@6470: dbaron@7813:dbaron@7813: Specifying other values of 'display', 'position', dbaron@7813: or 'float' is permitted, but is not allowed to change dbaron@7813: the computed value of 'display-inside'. dbaron@7813: (Since 'overflow', 'overflow-x', and 'overflow-y' only dbaron@7819: apply to block containers, flex containers, and grid containers dbaron@7813: the computed value of 'display-inside' is always dbaron@15115: ''display-inside/block'', ''display-inside/flex'', or dbaron@15115: ''display-inside/grid''. dbaron@7813: Need to specify exactly how this works, dbaron@7813: but it depends on dbaron@7813: having 'display-inside' and 'display-outside' specified. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: To match the model for other pseudo-elements dbaron@6470: where the pseudo-elements live inside their corresponding element, dbaron@6484: declarations in ''::nth-fragment()'' pseudo-elements override dbaron@6470: declarations in rules without the pseudo-element. dbaron@6470: The relative priority within such declarations is determined dbaron@6470: by normal cascading order (see [[!CSS21]]). dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6484: Styles specified on ''::nth-fragment()'' pseudo-elements dbaron@15115: do affect inheritance to content within the fragment box. dbaron@15115: In other words, the content within the fragment box must dbaron@6484: inherit from the fragment box's style (i.e., the pseudo-element style) dbaron@6470: rather than directly from the element. dbaron@6484: This means that elements split between fragment boxes may dbaron@6470: have different styles for different parts of the element. dbaron@6470:
dbaron@6470: dbaron@6472:dbaron@6472: This inheritance rule allows specifying styles indirectly dbaron@6472: (by using explicit ''inherit'' or using default inheritance dbaron@15117: on properties that don't apply to ''::first-letter'') dbaron@6472: that can't be specified directly dbaron@6472: (based on the rules in the next section). dbaron@6472: This is a problem. dbaron@6484: The restrictions that apply to styling inside fragments dbaron@6484: should also apply to inheritance from fragments. dbaron@6472:
dbaron@6472: dbaron@6480:<!DOCTYPE HTML> dbaron@6480: <style> dbaron@6480: .article { dbaron@6484: overflow: fragments; dbaron@6480: } dbaron@6484: .article::nth-fragment(1) { dbaron@6480: font-size: 1.5em; dbaron@6480: margin-bottom: 1em; dbaron@6480: height: 4em; dbaron@6480: } dbaron@6491: .article::nth-fragment(2) { dbaron@6480: margin-left: 5em; dbaron@6480: margin-right: 2em; dbaron@6480: } dbaron@6480: </style> dbaron@6480: <div class="article"> dbaron@6480: The <code>font-size</code> property... dbaron@6480: </div> |
dbaron@6484: The
dbaron@6484: font-size propertyspecified on the fragment is inherited into the descendants of the fragment.
dbaron@6480: This means that inherited properties can be used reliably on a fragment, as in this example. |
dbaron@6484: Should this apply to fragment overflow only, dbaron@6470: or also to paginated overflow, dbaron@6470: or even to pagination across pages? dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6484: The ''::nth-fragment()'' pseudo-element dbaron@6470: can also be used to style dbaron@15115: content inside of a fragment box. dbaron@6470: Unlike the ''::first-line'' and ''::first-letter'' pseudo-elements, dbaron@6484: the ''::nth-fragment()'' pseudo-element can be applied dbaron@6470: to parts of the selector other than the subject: dbaron@6470: in particular, it can match ancestors of the subject. dbaron@6470: However, the only CSS properties applied dbaron@6470: by rules with such selectors dbaron@6470: are those that apply dbaron@6470: to the ''::first-letter'' pseudo-element. dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: To be more precise, dbaron@6484: when a rule's selector has ''::nth-fragment()'' pseudo-elements dbaron@6470: attached to parts of the selector other than the subject, dbaron@6470: the declarations in that rule apply to dbaron@6470: a fragment (or pseudo-element thereof) when: dbaron@6470:
dbaron@6470:<!DOCTYPE HTML> dbaron@6481: <style> dbaron@6481: .dark-columns { dbaron@6484: overflow: fragments; dbaron@6481: width: 6em; dbaron@6481: height: 10em; dbaron@6481: float: left; dbaron@6481: margin-right: 1em; dbaron@6481: font: medium/1.25 Times New dbaron@6481: Roman, Times, serif; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(1) { dbaron@6481: background: aqua; color: black; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(1) :link { dbaron@6481: color: blue; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(1) :visited { dbaron@6481: color: purple; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(2) { dbaron@6481: background: navy; color: white; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(2) :link { dbaron@6481: color: aqua; dbaron@6481: } dbaron@6484: .dark-columns::nth-fragment(2) :visited { dbaron@6481: color: fuchsia; dbaron@6481: } dbaron@6481: </style> dbaron@6481: <div class="dark-columns"> dbaron@6481: ... dbaron@6481: </div> | dbaron@6484: dbaron@6484: dbaron@6481: |
dbaron@6470: Authors may wish to style the opening lines of an element dbaron@6470: with different styles dbaron@6484: by putting those opening lines in a separate fragment. dbaron@6470: However, since it may be difficult to predict the exact height dbaron@6470: occupied by those lines dbaron@6484: in order to restrict the first fragment to that height, dbaron@6470: this specification introduces a 'max-lines' property dbaron@6484: that forces a fragment to break dbaron@6470: after a specified number of lines. dbaron@6470: This forces a break after the given number of lines dbaron@6470: contained within the element or its descendants, dbaron@6470: as long as those lines are in the same block formatting context. dbaron@6470:
dbaron@6470: dbaron@15119:dbaron@15119: Name: max-lines dbaron@15181: Value: ''none'' | <dbaron@6470: dbaron@15115:> dbaron@15180: Initial: ''none'' dbaron@15119: Applies to: fragment boxes dbaron@15119: Inherited: no dbaron@15119: Animatable: as integer dbaron@15119: Percentages: N/A dbaron@15119: Media: visual dbaron@15119: Computed value: specified value dbaron@15119: Canonical order: per grammar dbaron@15119:
dbaron@6470: Breaks occur only as specified elsewhere. dbaron@6470:
dbaron@6470:dbaron@6470: In addition to any breaks specified elsewhere, dbaron@6470: a break is forced before any line that would exceed dbaron@6470: the given number of lines dbaron@6470: being placed inside the element dbaron@6470: (excluding lines that are in dbaron@6470: a different block formatting context from dbaron@6470: the block formatting context to which dbaron@6470: an unstyled child of the element would belong). dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: If there are multiple boundaries between this line dbaron@6470: and the previous, where exactly (in terms of element dbaron@6470: boundaries) is the break forced? dbaron@6470:
dbaron@6470: dbaron@6470:dbaron@6470: Only positive integers are accepted. dbaron@6470: Zero or negative integers are a parse error. dbaron@6470:
dbaron@6470:Should this apply to fragment overflow only, or also dbaron@6470: to pagination?
dbaron@6470: dbaron@6479:<!DOCTYPE HTML> dbaron@6479: <style> dbaron@6479: .article { dbaron@6484: overflow: fragments; dbaron@6479: } dbaron@6479: .article::first-letter { dbaron@6479: font-size: 2em; dbaron@6479: line-height: 0.9; dbaron@6479: } dbaron@6484: .article::nth-fragment(1) { dbaron@6479: font-size: 1.5em; dbaron@6479: max-lines: 3; dbaron@6479: } dbaron@6491: .article::nth-fragment(2) { dbaron@6479: column-count: 2; dbaron@6479: } dbaron@6479: </style> dbaron@6479: <div class="article"> dbaron@6479: ... dbaron@6479: </div> |
dbaron@6479: The max-lines property allows
dbaron@6479: authors to use a larger font for the first few lines of an article. Without the max-lines property, authors
dbaron@6479: might have to use the 'height' property instead, but that would leave a slight gap if the author miscalculated how much height a given number of lines would occupy (which might be particularly hard if the author
dbaron@6479: didn't know what text would be filling the space, exactly what font would be used, or exactly which platform's font rendering would be used to display the font). |
dbaron@6493: This specification should define useful behavior dbaron@6493: for all values of 'overflow' dbaron@6493: in static media (such as print). dbaron@6493: Current implementation behavior is quite poor and dbaron@6493: produces unexpected results when authors have not considered dbaron@6493: what will happen when dbaron@6493: the content they produce for interactive media dbaron@6493: is printed. dbaron@6493:
dbaron@6493: dbaron@6470:dbaron@6470: Thanks especially to the feedback from dbaron@6496: Rossen Atanassov, dbaron@6496: Bert Bos, dbaron@6496: Tantek Ãelik, dbaron@6496: John Daggett, dbaron@6496: fantasai, dbaron@6496: Daniel Glazman, dbaron@6496: Vincent Hardy, dbaron@6470: Håkon Wium Lie, dbaron@6496: Peter Linss, dbaron@7815: Robert O'Callahan, dbaron@6470: Florian Rivoal, dbaron@6473: Alan Stearns, dbaron@6496: Steve Zilles, dbaron@6470: and all the rest of the dbaron@6470: www-style community. dbaron@6470: