# CSS Overflow Module Level 3

## Editor’s Draft, 1 January 1970

Specification Metadata

This version:
  https://drafts.csswg.org/css-overflow-3/
Latest published version:
  https://www.w3.org/TR/css-overflow-3/
Previous Versions:
  https://www.w3.org/TR/2018/WD-css-overflow-3-20180731/
  https://www.w3.org/TR/2016/WD-css-overflow-3-20160531/
  https://www.w3.org/TR/2013/WD-css-overflow-3-20130418/
Editors:
  L. David Baron (Mozilla)
  Elika J. Etemad / fantasai (Invited Expert)
  Florian Rivoal (On behalf of Bloomberg)
Issue Tracking:
  GitHub Issues
Suggest an Edit for this Spec:
  GitHub Editor
Change Log:
  from 27 January 2015 to the present
  from 28 March 2013 to 27 January 2015
  from 31 July 2012 to 27 March 2013

Copyright © 1970 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.

## Abstract

This module contains the features of CSS relating to scrollable overflow handling in visual media.

CSS is a language for describing the rendering of structured documents (such as HTML and XML) on screen, on paper, etc.

## Status of this document

This is a public copy of the editors’ draft. It is provided for discussion only and may change at any moment. Its publication here does not imply endorsement of its contents by W3C. Don’t cite this document other than as work in progress.

GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text “css-overflow” in the title, preferably like this: “[css-overflow] …summary of comment…”. All issues and comments are archived, and there is also a historical archive.

This document was produced by the CSS Working Group.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 March 2019 W3C Process Document.

This update trims away most of the experimental new ideas for handling overflow that were described in the previous Working Draft. These ideas are not abandoned; they are merely deferred until Level 4. Level 3 is focused solely on completing a spec for the existing, shipped overflow features; work will resume on fragmented overflow and other fun things once this is completed.

The following features are at-risk, and may be dropped during the CR period:

- the max-lines property

“At-risk” is a W3C Process term-of-art, and does not necessarily imply that the feature is in danger of being dropped or delayed. It means that the WG believes the feature may have difficulty being interoperably implemented in a timely manner, and marking it as such allows the WG to drop the feature if necessary when transitioning to the Proposed Rec stage, without having to publish a new Candidate Rec without the feature first.

## 1. Introduction

In CSS Level 1 [CSS1], placing more content than would fit inside an element with a specified size was generally an authoring error. Doing so caused the content to extend outside the bounds of the element, which would likely cause that content to overlap with other elements.

CSS Level 2 [CSS21] introduced the overflow property, which allows authors to have overflow be handled by scrolling, which means it is no longer an authoring error. It also allows authors to specify that overflow is handled by clipping, which makes sense when the author’s intent is that the content not be shown.

This specification introduces the long-standing de-facto overflow-x and overflow-y properties, adds a clip value, and defines overflow handling more fully.

[Something something max-lines.]

Note: This specification also reproduces the definition of the text-overflow property previously defined in [CSS-UI-3], with no addition or modification, in order to present text-overflow and block-ellipsis toghether.

## 2. Types of Overflow

CSS uses the term overflow to describe the contents of a box that extend outside one of that box’s edges (i.e., its content edge, padding edge, border edge, or margin edge). The term might be interpreted as elements or features that cause this overflow, the non-rectangular region occupied by these features, or, more commonly, as the minimal rectangle that bounds that region. A box’s overflow is computed based on the layout and styling of the box itself and of all descendants whose containing block chain includes the box.

In most cases, overflow can be computed for any box from the bounds and properties of that box itself, plus the overflow of each of its children. However, this is not always the case; for example, when transform-style: preserve-3d [CSS3-TRANSFORMS] is used on some of the children, any of their descendants with transform-style: preserve-3d must also be examined.

There are two different types of overflow, which are used for different purposes by the UA:

- ink overflow
- scrollable overflow

### 2.1. Ink Overflow

The ink overflow of a box is the part of that box and its contents that creates a visual effect outside of the box’s border box. Ink overflow is the overflow of painting effects defined to not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, overhanging glyphs (with negative side bearings, or with ascenders/descenders extending outside the em box), outlines, etc.

Since some effects in CSS (for example, the blurs in text-shadow [CSS-TEXT-3] and box-shadow [CSS-BACKGROUNDS-3], which are theoretically infinite) do not define what visual extent they cover, the extent of the ink overflow is undefined.

The ink overflow region is the non-rectangular area occupied by the ink overflow of a box and its contents, and the ink overflow rectangle is the minimal rectangle whose axes are aligned to the box’s axes and that contains the ink overflow region. Note that the ink overflow rectangle is a rectangle in the box’s coordinate system, but might be non-rectangular in other coordinate systems due to transforms. [CSS3-TRANSFORMS]

### 2.2. Scrollable Overflow

The scrollable overflow of a box is the set of things extending outside of that box’s padding edge for which a scrolling mechanism needs to be provided.

The scrollable overflow region is the non-rectangular region occupied by the scrollable overflow, and the scrollable overflow rectangle is the minimal rectangle whose axes are aligned to the box’s axes and that contains the scrollable overflow region.

The scrollable overflow region is the union of:

- the box’s own content and padding areas
  There’s disagreement on the scrolling model. 2.1 apparently defined that you scrolled the *content* area; the content would overflow the content-box, and you would union that overflow with the content box to find the scrollable area. In particular, this means that the content would be offset by the start-sides padding, but if it overflowed, it would go right to the edge on the end sides. This is what Firefox and IE do.

  At least some authors (and spec authors) instead have the mental model that the padding box is what’s scrollable, so when you scroll to the end of the overflow, there’s the right/bottom padding. Chrome/WebKit do this for the block axis, at least. They’re somewhat inconsistent for the inline axis; there’s something weird about how they handle lineboxes.

  It seems that the block-axis padding is probably web-compatible to honor. It’s unclear that the inline-axis padding will be. Further experimentation is needed.

- all line boxes directly contained by the box
- the border boxes of all boxes for which it is the containing block and whose border boxes are positioned not wholly outside its block-start or inline-start padding edges, accounting for transforms by projecting each box onto the plane of the element that establishes its 3D rendering context. [CSS3-TRANSFORMS]

  Is this description of handling transforms sufficiently accurate?

- the scrollable overflow regions of all of the above boxes (accounting for transforms as described above), provided they themselves have overflow: visible (i.e. do not themselves trap the overflow) and that scrollable overflow is not already clipped (e.g. by the clip property or the contain property).

  should overflow: clip also clip the scrollable overflow or should it remain a pure paint-time operation, which would mean that scrollable overflow, while invisible, would still be scrollable.

  Note: The mask-* properties [CSS-MASKING-1] do not affect the scrollable overflow region.

  Need to evaluate compat of honoring or ignoring clip and clip-path.

- Padding on the end-edge sides of the scrollable overflow rectangle representing the end-side padding applied to the scroll container, added such that its content can be scrolled to a position that would satisfy the requirements of place-content: end alignment. Including this padding is optional for block containers in any axis whose corresponding content-distribution property (align-content/justify-content) is normal.

  It’s not yet clear if including the end-side padding in the scrollable layer of block containers is Web-compatible, so this clause is under investigation. It appears that Chrome and Safari include such padding in the block axis; and the behavior in the inline axis is not clear. <https://github.com/w3c/csswg-drafts/issues/129>

- the margin areas of grid item and flex item boxes for which the box establishes a containing block. The UA may additionally include the margin areas of other boxes for which the box establishes a containing block; however, the conditions under which such margin areas are included is undefined in this level. This needs further testing and investigation; is therefore deferred in this draft.

Note: The scrollable overflow rectangle is always a rectangle in the box’s own coordinate system, but might be non-rectangular in other coordinate systems due to transforms [CSS3-TRANSFORMS]. This means scrollbars can sometimes appear when not actually necessary.

## 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties

These properties specify whether a box’s content (including any ink overflow) is clipped to its padding edge, and if so, whether it is a scroll container that allows the user to scroll clipped parts of its scrollable overflow region into view. The visual viewport of the scroll container (through which the scrollable overflow region can be viewed) coincides with its padding box, and is called the scrollport.

Name: | overflow-x, overflow-y
Value: | visible | hidden | clip | scroll | auto
Initial: | visible
Applies to: | block containers [CSS21], flex containers [CSS3-FLEXBOX], and grid containers [CSS3-GRID-LAYOUT]
Inherited: | no
Percentages: | N/A
Computed value: | as specified, except with visible/clip computing to auto/hidden (respectively) if one of overflow-x or overflow-y is neither visible nor clip
Canonical order: | per grammar
Animation type: | discrete

The overflow-x property specifies the handling of overflow in the horizontal direction (i.e., overflow from the left and right sides of the box), and the overflow-y property specifies the handling of overflow in the vertical direction (i.e., overflow from the top and bottom sides of the box).

Name: | overflow
Value: | [ visible | hidden | clip | scroll | auto ]{1,2}
Initial: | visible
Applies to: | block containers [CSS21], flex containers [CSS3-FLEXBOX], and grid containers [CSS3-GRID-LAYOUT]
Inherited: | no
Percentages: | N/A
Computed value: | see individual properties
Animation type: | discrete
Canonical order: | per grammar

The overflow property is a shorthand property that sets the specified values of overflow-x and overflow-y in that order. If the second value is omitted, it is copied from the first.

Values have the following meanings:

visible
  There is no special handling of overflow, that is, the box’s content is rendered outside the box if positioned there. The box is not a scroll container.
hidden
  This value indicates that the box’s content is clipped to its padding box and that the UA must not provide any scrolling user interface to view the content outside the clipping region, nor allow scrolling by direct intervention of the user, such as dragging on a touch screen or using the scrolling wheel on a mouse. However, the content must still be scrollable programatically, for example using the mechanisms defined in [CSSOM-VIEW], and the box is therefore still a scroll container.
clip
  Like hidden, this value indicates that the box’s content is clipped to its padding box and that no scrolling user interface should be provided by the UA to view the content outside the clipping region. In addition, unlike overflow: hidden which still allows programmatic scrolling, overflow: clip forbids scrolling entirely, through any mechanism, and therefore the box is not a scroll container.

  Unlike hidden, this value does not cause the element to establish a new formatting context.

  Note: Authors who also want the box to establish a formatting context may use display: flow-root together with overflow: clip.

scroll
  This value indicates that the content is clipped to the padding box, but can be scrolled into view (and therefore the box is a scroll container). Furthermore, if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism should be displayed whether or not any of its content is clipped. This avoids any problem with scrollbars appearing and disappearing in a dynamic environment. When the target medium is print, overflowing content may be printed; it is not defined where it may be printed.
auto
  Like scroll when the box has scrollable overflow; like hidden otherwise. Thus, if the user agent uses a scrolling mechanism that is visible on the screen (such as a scroll bar or a panner), that mechanism will only be displayed if there is overflow.

If the computed value of overflow on a block box is neither visible nor clip nor a combination thereof, it establishes an independent formatting context for its contents.

### 3.1. Overflow in Print and Other Static Media

Since scrolling is not possible in static media (such as print) authors should be careful to make content accessible in such media, for example by using @media print, (update: none) { … } to adjust layout such that all relevant content is simultaneously visible.

On scroll containers in non-interactive media with an overflow value of auto or scroll (but not hidden) UAs may display an indication of any scrollable overflow, such as by displaying scrollbars or an ellipsis.

Note: Not all paged media is non-interactive for example, e-book readers page content, but are interactive.

### 3.2. Scrollbars and Layout

In the case of a scrollbar being placed on an edge of the element’s box, it should be inserted between the inner border edge and the outer padding edge. Any space taken up by the scrollbars should be taken out of (subtracted from the dimensions of) the containing block formed by the element with the scrollbars.

import examples from [CSS3-BOX].

### 3.3. Scrolling Origin, Direction, and Restriction

The initial scroll position, that is, the initial position of the box’s scrollable overflow region with respect to its border box, prior to any user or programmatic scrolling that changes it, is dependent on the box’s writing mode, and is by default the block-start/inline-start edge of the box’s padding edge. However, the align-content and justify-content properties [CSS-ALIGN-3] can be used to change this, see CSS Box Alignment 3 §5.3 Overflow and Scroll Positions.

Due to Web-compatibility constraints (caused by authors exploiting legacy bugs to surreptitiously hide content from visual readers but not search engines and/or speech output), UAs must clip the scrollable overflow region of scroll containers on the block-start and inline-start sides of the box (thereby behaving as if they had no scrollable overflow on that side).

The viewport uses the principal writing mode for these calculations.

### 3.4. Overflow Viewport Propagation

UAs must apply the overflow-* values set on the root element to the viewport. However, when the root element is an [HTML] `html` element (including XML syntax for HTML) whose overflow value is visible (in both axes), and that element has a `body` element as a child, user agents must instead apply the overflow-* values of the first such child element to the viewport. The element from which the value is propagated must then have a used overflow value of visible.

The overflow values are not propagated to the viewport if no boxes are generated for the element whose overflow values would be used for the viewport (for example, if the root element has display: none).

If visible is applied to the viewport, it must be interpreted as auto. If clip is applied to the viewport, it must be interpreted as hidden.

### 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties

The following properties are processed according to the same processing model as the Flow-Relative box model properties defined in CSS Logical Properties 1 §4 Flow-Relative Box Model Properties.

Name: | overflow-inline, overflow-block
Value: | <'overflow'>
Initial: | visible
Applies to: | Same as overflow-x and overflow-y
Inherited: | no
Percentages: | N/A
Computed value: | Same as overflow-x and overflow-y
Canonical order: | per grammar
Animation type: | discrete

These properties correspond to the overflow-x and overflow-y properties. The mapping depends on the element’s writing-mode.

## 4. Automatic Ellipses

### 4.1. Overflow Ellipsis: the text-overflow property

Name: | text-overflow
Value: | clip | ellipsis
Initial: | clip
Applies to: | block containers
Inherited: | no
Percentages: | N/A
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

This property specifies rendering when inline content overflows its end line box edge in the inline progression direction of its block container element ("the block") that has overflow other than visible.

Text can overflow for example when it is prevented from wrapping (e.g. due to `white-space: nowrap` or a single word is too long to fit). Values have the following meanings:

clip
  Clip inline content that overflows its block container element. Characters may be only partially rendered.
ellipsis
  Render an ellipsis character (U+2026) to represent clipped inline content. Implementations may substitute a more language, script, or writing-mode appropriate ellipsis character, or three dots "..." if the ellipsis character is unavailable.

The term "character" is used in this property definition for better readability and means "grapheme cluster" [UAX29] for implementation purposes.

For the ellipsis value implementations must hide characters and atomic inline-level elements at the end edge of the line as necessary to fit the ellipsis, and place the ellipsis immediately adjacent to the end edge of the remaining inline content. The first character or atomic inline-level element on a line must be clipped rather than ellipsed.

#### Bidi ellipsis examples

These examples demonstrate which characters get hidden to make room for the ellipsis in a bidi situation: those visually at the end edge of the line.

Sample CSS:

    div {
      font-family: monospace;
      white-space: pre;
      overflow: hidden;
      width: 9ch;
      text-overflow: ellipsis;
    }

Sample HTML fragments, renderings, and your browser:

HTML | Reference rendering | Your Browser
--- | --- | ---
`<div>שלום 123456</div>` | 123456 ם… | שלום 123456
`<div dir=rtl>שלום 123456</div>` | …456 שלום | שלום 123456

#### ellipsing details

- Ellipsing only affects rendering and must not affect layout nor dispatching of pointer events: The UA should dispatch any pointer event on the ellipsis to the elided element, as if text-overflow had been none.
- The ellipsis is styled and baseline-aligned according to the block.
- Ellipsing occurs after relative positioning and other graphical transformations.
- If there is insufficient space for the ellipsis, then clip the rendering of the ellipsis itself (on the same side that neutral characters on the line would have otherwise been clipped with the text-overflow:clip value).

#### user interaction with ellipsis

- When the user is interacting with content (e.g. editing, selecting, scrolling), the user agent may treat text-overflow: ellipsis as text-overflow: clip.
- Selecting the ellipsis should select the ellipsed text. If all of the ellipsed text is selected, UAs should show selection of the ellipsis. Behavior of partially-selected ellipsed text is up to the UA.

Example(s):

#### text-overflow examples

These examples demonstrate setting the text-overflow of a block container element that has text which overflows its dimensions:

sample CSS for a div:

    div {  font-family:Helvetica,sans-serif; line-height:1.1;
      width:3.1em; padding:.2em; border:solid .1em black; margin:1em 0;
    }

sample HTML fragments, renderings, and your browser:

HTML | sample rendering | your browser
--- | --- | ---
    <div>
    CSS IS AWESOME, YES
    </div>
|  | CSS IS AWESOME, YES
    <div style="text-overflow:clip; overflow:hidden">
    CSS IS AWESOME, YES
    </div>
|  | CSS IS AWESOME, YES
    <div style="text-overflow:ellipsis; overflow:hidden">
    CSS IS AWESOME, YES
    </div>
|  | CSS IS AWESOME, YES
    <div style="text-overflow:ellipsis; overflow:hidden">
    NESTED
     <p>PARAGRAPH</p>
    WON’T ELLIPSE.
    </div>
|  | NESTED PARAGRAPH WON’T ELLIPSE.

Note: the side of the line that the ellipsis is placed depends on the direction of the block. E.g. an overflow hidden right-to-left (`direction: rtl`) block clips inline content on the left side, thus would place a text-overflow ellipsis on the left to represent that clipped content.

#### ellipsis interaction with scrolling interfaces

This section applies to elements with text-overflow other than text-overflow:clip (non-clip text-overflow) and overflow:scroll.

When an element with non-clip text-overflow has overflow of scroll in the inline progression dimension of the text, and the browser provides a mechanism for scrolling (e.g. a scrollbar on the element, or a touch interface to swipe-scroll, etc.), there are additional implementation details that provide a better user experience:

When an element is scrolled (e.g. by the user, DOM manipulation), more of the element’s content is shown. The value of text-overflow should not affect whether more of the element’s content is shown or not. If a non-clip text-overflow is set, then as more content is scrolled into view, implementations should show whatever additional content fits, only truncating content which would otherwise be clipped (or is necessary to make room for the ellipsis/string), until the element is scrolled far enough to display the edge of the content at which point that content should be displayed rather than an ellipsis/string.

Example(s):

This example uses text-overflow on an element with overflow scroll to demonstrate the above described behavior.

sample CSS:

    div.crawlbar {
      text-overflow: ellipsis;
      height: 2em;
      overflow: scroll;
      white-space: nowrap;
      width: 15em;
      border:1em solid black;
    }

sample HTML fragment:

    <div class="crawlbar">
    CSS is awesome, especially when you can scroll
    to see extra text instead of just
    having it overlap other text by default.
    </div>

demonstration of sample CSS and HTML:

CSS is awesome, especially when you can scroll to see extra text instead of just having it overlap other text by default.

While the content is being scrolled, implementations may adjust their rendering of ellipses (e.g. align to the box edge rather than line edge).

### 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

Name: | block-ellipsis
Value: | none | auto | <string>
Initial: | none
Applies to: | block containers
Inherited: | yes
Percentages: | N/A
Computed value: | specified value
Canonical order: | per grammar
Animation type: | discrete

This property allows inserting content into the last line box before a (forced or unforced) region break to indicate the continuity of truncated/interrupted content. It only affects line boxes contained directly by the block container itself, but as it inherits, will have an effect on descendants’ line boxes unless overridden. If the box contains no line box immediately preceding a region break, then this property has no effect.

Note: See § 5 Fragmenting Overflow for a way to generate boxes with such a region break.

Should this apply to other types of fragmentation breaks (e.g. pages, columns)?

The inserted content is called the block overflow ellipsis. Values have the following meanings:

none
  The rendering is unaffected.
auto
  Render an ellipsis character (U+2026)—or a more typographically-appropriate equivalent—as the block overflow ellipsis at the end of the affected line box. UAs should use the conventions of the content language, writing system, and writing mode to determine the most appropriate ellipsis string.
<string>
  Render the specified string as the block overflow ellipsis at the end of the affected line box. The UA may truncate this string if it is absurdly long.

When block-ellipsis is not none, the block overflow ellipsis string is wrapped in an anonymous inline and placed at the end of the line box as a direct child of the block container’s root inline box, reducing the space in the line box available to the other contents of the line. This inline is assigned unicode-bidi: plaintext and line-height: 0 and is placed in the line box after the last soft wrap opportunity (see [CSS-TEXT-3]) that would still allow the entire block overflow ellipsis to fit on the line. For this purpose, soft wrap opportunities added by overflow-wrap are ignored. If this results in the entire contents of the line box being displaced, the line box is considered to contain a strut, as defined in . Text alignment and justification occurs after placement, and measures the inserted block overflow ellipsis together with the rest of the line’s content.

Note: Setting the block overflow ellipsis's line-height to 0 makes sure that inserting it cannot cause the line’s height to grow, which could cause further relayouts and potentially cycles. This is almost equivalent to inserting the block overflow ellipsis as a paint-time operation, except that it still participates in alignment and justification. The downside is that unusually tall / deep glyphs in the block overflow ellipsis may overflow.

The block overflow ellipsis must not be included in either the ::first-letter nor the ::first-line pseudo-elements.

If there is a subsequent fragmentation container in the fragmentation context that would receive subsequent content, then the content displaced by the block overflow ellipsis must be pushed to that fragmentation container.

The UA must treat the block overflow ellipsis as an unbreakable string, If any part of the block overflow ellipsis overflows, it is treated as scrollable overflow, and its rendering is affected by the text-overflow property.

The block overflow ellipsis does not capture events: pointer events are dispatched to whatever is underneath it.

It also has no effect on the intrinsic size of the box: its min-content and max-content sizes are calculated exactly as if block-ellipsis were none.

Note: Future specifications may extend this feature, for example by providing an ::ellipsis pseudo-element to style the text, or by allowing the selection of a child element of the block to use as either an inline-level or block-level indicator (in which case, it can capture events).

## 5. Fragmenting Overflow

### 5.1. Limiting Visible Lines: the line-clamp shorthand property

Name: | line-clamp
Value: | none | <integer> <'block-ellipsis'>?
Initial: | none
Applies to: | see individual properties
Inherited: | see individual properties
Percentages: | N/A
Computed value: | see individual properties
Animation type: | see individual properties
Canonical order: | per grammar

The line-clamp property is a shorthand for the max-lines, block-ellipsis, and continue properties.

For the time being, experiemental implementations are encouraged to follow the full behavior defined by this shorthand and its longhands, but to only expose the shorthand to authors. This is in order to facilitate further tweaking, and in particular potential renaming, of the longhand properties and their values.

It allows limiting the contents of a block container to the specified number of lines; remaining content is fragmented away and neither rendered nor measured. Optionally, it also allows inserting content into the last line box to indicate the continuity of truncated/interrupted content.

The values have the following meaning:

none
  Sets max-lines to none, continue to auto, and block-ellipsis to none.
<integer>
  Sets max-lines to the specified <integer>, continue to discard, and the block-ellipsis property to second component of the value or to auto if omitted.

See the corresponding longhand properties for details about how this mechanism operates.

In this example, the lead paragraph of each article is listed in a shortened menu, truncated to fit within 10 lines that end with “… (continued on next page)”:

    li {
      line-clamp: 5 "… (continued on next page)";
    }
    strong {
      display: block;
      text-transform: uppercase;
    }

    <li><a href="cheese-is-milk">
      <strong>Cheese is Actually Made of Milk!</strong>
      Investigative reporters at the World Wide Web Press Corps
      have discovered the secret of cheese.
      Tracing through byzantine layers of bureacracy and shadow corporations,
      our crack team of journalists have traced the source of camembert.
    </a></li>

Sample rendering:

    +---------------------------------------+
    | CHEESE IS ACTUALLY MADE OF MILK!      |
    | Investigative reporters at the World  |
    | Wide Web Press Corps have discovered  |
    | the secret of cheese. Tracing through |
    | byzantine…  (continued on next page)  |
    +---------------------------------------+

#### 5.1.1. Legacy compatibility

For compatibility with legacy content, UAs that support line-clamp must also support the -webkit-line-clamp property. Like line-clamp, it is a shorthand of max-lines, continue, and block-ellipsis, except that:

- its syntax is none | <integer>

- it sets continue to -webkit-discard instead of discard

- it unconditionally sets block-ellipsis to auto

Additionally, for children (including anonymous children) of boxes whose display property computes to -webkit-box or -webkit-inline-box, the used values of the max-lines, continue, and block-ellipsis properties are taken from the computed values of the parent box; the computed values of these properties on the box itself are ignored.

The -webkit-discard value behaves identically to discard, except that it only takes effect if the computed value of the display property on the parent is -webkit-box or -webkit-inline-box and the computed value of the -webkit-box-orient property on the parent is vertical.

Note: Implementations of the legacy -webkit-line-clamp property have not behaved identically to what is specified here. The historical behavior is quirky and less robust, as documented for example in this blog post. The current design learns from the mistakes of that early experiment, and is intended to be sufficiently compatible with existing content that implementations can eventually be changed to follow to the specified behavior. If further adjustments are found to be necessary, they will be incorporated to this specification. In the meanwhile, authors should be aware that there may be discrepancies.

### 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

Name: | max-lines
Value: | none | <integer>
Initial: | none
Applies to: | block containers which are also fragmentation containers that capture region breaks
Inherited: | no
Percentages: | N/A
Computed value: | the keyword none or an integer
Canonical order: | per grammar
Animation type: | by computed value type

This property has no effect on boxes that are not fragmentation containers that capture region breaks.

Otherwise, if the value of max-lines is not none, a region break is forced after its Nth descendant in-flow line box, where N is the specified value of max-lines. Only lines boxes in the same Block Formatting Context are counted: the contents of descendants that establish independent formatting contexts are skipped over while counting line boxes.

If fewer than N line boxes exist, then max-lines introduces no region break.

As continue: discard does not cause the element to establish an independent formatting context, lines in a nested element with line-clamp are counted, as can be seen in the examples below.

    <div id=a>
      a: line 1<br>
      a: line 2<br>
      <div id=b>
        b: line 1<br>
        b: line 2<br>
        b: line 3<br>
        b: line 4<br>
      </div>
      a: line 3<br>
      a: line 4<br>
    </div>

Sample rendering given `#a { line-clamp: 5; } b { line-clamp: 2; }`:

    a: line 1
    a: line 2
    b: line 1
    b: line 2…
    a: line 3…

Sample rendering given `#a { line-clamp: 3; } b { line-clamp: 2; }`:

    a: line 1
    a: line 2
    b: line 1…

Note that in the second case, the maximum of 2 lines set on element #b does not take effect, since a forced break is introduced before the second line of this element.

Note: This implies that max-lines has no effect when applied to multi-column containers, since any line box they contain are nested into independent formatting contexts.

Only positive integers are accepted. Zero or negative integers are invalid and must cause the declaration to be ignored.

Note: The widows, orphans, and break-inside properties do not affect the position of the forced region break introduced by the max-lines property.

Note: Despite the “region break” name, this is not a dependency on [CSS-REGIONS-1]. The word “region” is only used as a classifier for forced breaks: they can be “page breaks” (breaks across pages [css-page-3]), “column breaks” (breaks across multi-column layout columns [css-multicol-1]), or “region breaks” (breaks across any other kind of CSS-induced fragmentation containers).

If an implementation supports neither [CSS-REGIONS-1] nor CSS Overflow 4 §5 Fragmentation of overflow, then it will have had no occasion yet to run into that kind of breaks, and this will be an addition. However the addition does not involve bringing over any of the [CSS-REGIONS-1] functionality. All that is needed is:

- be able to fragment

- classify these fragmentation containers as “Category 3” (i.e. not pages nor columns) for the purpose of forced breaks.

### 5.3. Fragmentation of Overflow: the continue property

Name: | continue
Value: | auto | discard
Initial: | auto
Applies to: | block containers and multicol containers
Inherited: | no
Percentages: | N/A
Computed value: | specified keyword
Canonical order: | per grammar
Animation type: | discrete

The continue property gives authors the ability to turn a box into a fragmentation container (see [CSS-BREAK-3]) and to specify that content after the fragmentation break must be discarded.

This property is meant to generalize and replace the `region-fragment` property from [CSS-REGIONS-1]. Once it is sufficiently stable in this specification, `region-fragment` should be removed from the regions specification in favor of this.

auto

  If the box has more content than can fit, the excess content is handled according to the usual rules.

discard
  The box becomes a fragmentation container that captures region breaks, if it is not already. [CSS-BREAK-3]

  The position of the first forced region break (whether imposed by max-lines or by another mechanism, such as the break-before/break-after properties) or the position of the first unforced break, which ever comes sooner, is treated as the end of the fragmentation container, and the remaining content after the fragmentation break is discarded, similar to if it were display: none:

  - It is not rendered

  - Just as the content is visually hidden, it is not made available for speech rendering

  - It does not allow user interaction

  - Make sure effects on OM are well defined <https://github.com/w3c/csswg-drafts/issues/2970>

  - Positioned elements whose static position is in the discarded content are not rendered.

    Are we sure about that? Discussions in the Syndey F2F meeting seemed to generally converge on this, but other possibilities were raised. <https://github.com/w3c/csswg-drafts/issues/2971>

  However, since intrinsic sizes are calculated across fragmentation containers, this content is taken into account for the purpose of finding the box’s min-content and max-content inline sizes (see CSS Fragmentation 3 §5.1 Breaking into Varying-size Fragmentainers). Min-content and max-content block sizes are calculated based on the content from the start of the fragmented flow to the first forced break if any, or to the end of the fragmented flow if there is no forced break.

  Note: Calculating intrinsic block sizes to the first forced or unforced break would cause intrinsic sizes to depend on layout, which would cause circularities.

  The effect on multi-column containers is to discard any overflow column.

  Note: In the case of parallel fragmentation flows, content occuring after the fragmentation break in the box tree could still be rendered, if it is laid out above the position representing the end of this fragmentation container.

Note: This property does not cause the box to establish an independent formatting context.

Given an article with one excessively long overflowing line, and four more lines than can fit in the fragmentation direction as in the illustration bellow, different renderings are possible based on the combination of the overflow and continue property.

| continue: discard | continue: auto
--- | --- | ---
overflow: visible |  |
overflow: hidden |  |

## 6. Privacy and Security Considerations

This specification introduces no new privacy or security concerns.

## Acknowledgments

Thanks especially to the feedback from Rossen Atanassov, Bert Bos, Tantek Çelik, John Daggett, Daniel Glazman, Vincent Hardy, Håkon Wium Lie, Peter Linss, Robert O’Callahan, Florian Rivoal, Alan Stearns, Steve Zilles, and all the rest of the www-style community.

## Conformance

### Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with `class="example"`, like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with `class="note"`, like this:

Note, this is an informative note.

Advisements are normative sections styled to evoke special attention and are set apart from other normative text with `<strong class="advisement">`, like this: UAs MUST provide an accessible alternative.

### Conformance classes

Conformance to this specification is defined for three conformance classes:

style sheet
  A CSS style sheet.
renderer
  A UA that interprets the semantics of a style sheet and renders documents that use them.
authoring tool
  A UA that writes a style sheet.

A style sheet is conformant to this specification if all of its statements that use syntax defined in this module are valid according to the generic CSS grammar and the individual grammars of each feature defined in this module.

A renderer is conformant to this specification if, in addition to interpreting the style sheet as defined by the appropriate specifications, it supports all the features defined by this specification by parsing them correctly and rendering the document accordingly. However, the inability of a UA to correctly render a document due to limitations of the device does not make the UA non-conformant. (For example, a UA is not required to render color on a monochrome monitor.)

An authoring tool is conformant to this specification if it writes style sheets that are syntactically correct according to the generic CSS grammar and the individual grammars of each feature in this module, and meet all other conformance requirements of style sheets as described in this module.

### Requirements for Responsible Implementation of CSS

The following sections define several conformance requirements for implementing CSS responsibly, in a way that promotes interoperability in the present and future.

#### Partial Implementations

So that authors can exploit the forward-compatible parsing rules to assign fallback values, CSS renderers must treat as invalid (and ignore as appropriate) any at-rules, properties, property values, keywords, and other syntactic constructs for which they have no usable level of support. In particular, user agents must not selectively ignore unsupported property values and honor supported values in a single multi-value property declaration: if any value is considered invalid (as unsupported values must be), CSS requires that the entire declaration be ignored.

#### Implementations of Unstable and Proprietary Features

To avoid clashes with future stable CSS features, the CSSWG recommends following best practices for the implementation of unstable features and proprietary extensions to CSS.

#### Implementations of CR-level Features

Once a specification reaches the Candidate Recommendation stage, implementers should release an unprefixed implementation of any CR-level feature they can demonstrate to be correctly implemented according to spec, and should avoid exposing a prefixed variant of that feature.

To establish and maintain the interoperability of CSS across implementations, the CSS Working Group requests that non-experimental CSS renderers submit an implementation report (and, if necessary, the testcases used for that implementation report) to the W3C before releasing an unprefixed implementation of any CSS features. Testcases submitted to W3C are subject to review and correction by the CSS Working Group.

Further information on submitting testcases and implementation reports can be found from on the CSS Working Group’s website at http://www.w3.org/Style/CSS/Test/. Questions should be directed to the public-css-testsuite@w3.org mailing list.

Support: Android Browser2.1+Baidu Browser7.12+Blackberry Browser7+Chrome4+Chrome for Android74+Edge12+Firefox7+Firefox for Android66+IE6+IE Mobile10+KaiOS Browser2.5+Opera11+Opera MiniAllOpera Mobile12.1+QQ Browser1.2+Safari3.1+Samsung Internet4+UC Browser for Android11.8+iOS Safari3.2+

Source: caniuse.com as of 2019-06-04

## Index

### Terms defined by this specification

- auto
  - value for block-ellipsis, in §4.2
  - value for continue, in §5.3
  - value for overflow, overflow-x, overflow-y, in §3
- block-ellipsis, in §4.2
- block overflow ellipsis, in §4.2
- clip
  - value for overflow, overflow-x, overflow-y, in §3
  - value for text-overflow, in §4.1
- continue, in §5.3
- discard, in §5.3
- ellipsis, in §4.1
- hidden, in §3
- initial scroll position, in §3.3
- ink overflow, in §2.1
- ink overflow rectangle, in §2.1
- ink overflow region, in §2.1
- <integer>, in §5.1
- line-clamp, in §5.1
- max-lines, in §5.2
- none
  - value for block-ellipsis, in §4.2
  - value for line-clamp, in §5.1
  - value for max-lines, in §5.2
- overflow
  - (property), in §3
  - definition of, in §2
- overflow-block, in §3.5
- overflow-inline, in §3.5
- overflow-x, in §3
- overflow-y, in §3
- scroll, in §3
- scrollable overflow, in §2.2
- scrollable overflow rectangle, in §2.2
- scrollable overflow region, in §2.2
- scroll container, in §3
- scrollport, in §3
- <string>, in §4.2
- text-overflow, in §4.1
- visible, in §3
- -webkit-discard, in §5.1.1
- -webkit-line-clamp, in §5.1.1

https://drafts.csswg.org/css-align-3/#propdef-align-content Referenced in:

- 2.2. Scrollable Overflow
- 3.3. Scrolling Origin, Direction, and Restriction

https://drafts.csswg.org/css-align-3/#content-distribution-properties Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-align-3/#propdef-justify-content Referenced in:

- 2.2. Scrollable Overflow
- 3.3. Scrolling Origin, Direction, and Restriction

https://drafts.csswg.org/css-align-3/#valdef-justify-content-normal Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-align-3/#propdef-place-content Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-backgrounds-3/#propdef-box-shadow Referenced in:

- 2.1. Ink Overflow

https://drafts.csswg.org/css-break-3/#propdef-break-after Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-break-3/#propdef-break-before Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-break-3/#propdef-break-inside Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-break-3/#propdef-orphans Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-break-4/#forced-break Referenced in:

- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-break-4/#fragmentation-break Referenced in:

- 5.3. Fragmentation of Overflow: the continue property (2) (3)

https://drafts.csswg.org/css-break-4/#fragmentation-container Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property (2) (3)
- 5.3. Fragmentation of Overflow: the continue property (2) (3) (4) (5)

https://drafts.csswg.org/css-break-4/#fragmentation-context Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-break-4/#fragmentation-direction Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-break-4/#fragmented-flow Referenced in:

- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-break-4/#region-break Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2) (3)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property (2) (3) (4) (5)
- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-break-4/#unforced-break Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-break-4/#propdef-widows Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-cascade-4/#shorthand-property Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property

https://drafts.csswg.org/css-contain-1/#propdef-contain Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-display-3/#block-box Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties

https://drafts.csswg.org/css-display-3/#block-container Referenced in:

- 2.2. Scrollable Overflow
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2) (3)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-display-3/#block-formatting-context Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-display-3/#containing-block-chain Referenced in:

- 2. Types of Overflow

https://drafts.csswg.org/css-display-3/#propdef-display Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 5.1.1. Legacy compatibility (2)
- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-display-3/#establish-an-independent-formatting-context Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-display-3/#establish-an-independent-formatting-context Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-display-3/#in-flow Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-display-3/#independent-formatting-context Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property (2)

https://drafts.csswg.org/css-inline-3/#root-inline-box Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.fxtf.org/css-masking-1/#propdef-clip Referenced in:

- 2.2. Scrollable Overflow (2)

https://drafts.fxtf.org/css-masking-1/#propdef-clip-path Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-multicol-1/#multi-column-container Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-multicol-1/#multi-column-container Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-multicol-1/#overflow-columns Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-sizing-3/#max-content Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property
- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-sizing-3/#max-content Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property
- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-sizing-3/#min-content-inline-size Referenced in:

- 5.3. Fragmentation of Overflow: the continue property (2)

https://drafts.csswg.org/css-sizing-3/#min-content Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-syntax-3/#css-ignored Referenced in:

- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-text-3/#content-language Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-text-3/#propdef-overflow-wrap Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-text-3/#soft-wrap-opportunity Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)

https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow Referenced in:

- 2.1. Ink Overflow

https://drafts.csswg.org/css-transforms-2/#3d-rendering-context Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-transforms-2/#propdef-transform-style Referenced in:

- 2. Types of Overflow (2)

https://drafts.csswg.org/css-values-3/#integer-value Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property (2) (3)
- 5.1.1. Legacy compatibility
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

https://drafts.csswg.org/css-values-3/#string-value Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)

https://drafts.csswg.org/css-values-4/#mult-opt Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property

https://drafts.csswg.org/css-values-4/#mult-num-range Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties

https://drafts.csswg.org/css-values-4/#comb-one Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4) (5) (6) (7) (8)
- 4.1. Overflow Ellipsis: the text-overflow property
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)
- 5.1. Limiting Visible Lines: the line-clamp shorthand property
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-writing-modes-3/#propdef-direction Referenced in:

- user interaction with ellipsis

https://drafts.csswg.org/css-writing-modes-3/#physical-left Referenced in:

- user interaction with ellipsis (2)

https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-writing-modes-4/#block-size Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-writing-modes-4/#block-start Referenced in:

- 2.2. Scrollable Overflow
- 3.3. Scrolling Origin, Direction, and Restriction (2)

https://drafts.csswg.org/css-writing-modes-4/#end Referenced in:

- 4.1. Overflow Ellipsis: the text-overflow property (2) (3)

https://drafts.csswg.org/css-writing-modes-4/#inline-size Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://drafts.csswg.org/css-writing-modes-4/#inline-start Referenced in:

- 2.2. Scrollable Overflow
- 3.3. Scrolling Origin, Direction, and Restriction

https://drafts.csswg.org/css-writing-modes-4/#principal-writing-mode Referenced in:

- 3.3. Scrolling Origin, Direction, and Restriction

https://drafts.csswg.org/css-writing-modes-4/#writing-mode Referenced in:

- 3.3. Scrolling Origin, Direction, and Restriction
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-writing-modes-4/#propdef-writing-mode Referenced in:

- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties

https://drafts.csswg.org/css2/visudet.html#propdef-line-height Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)

https://www.w3.org/TR/CSS22/visuren.html#positioned-element Referenced in:

- 5.3. Fragmentation of Overflow: the continue property

https://www.w3.org/TR/CSS22/visudet.html#strut-element Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

https://drafts.csswg.org/css-box-3/#padding-edge Referenced in:

- 3.3. Scrolling Origin, Direction, and Restriction

https://drafts.csswg.org/css-flexbox-1/#flex-item Referenced in:

- 2.2. Scrollable Overflow

https://drafts.csswg.org/css-grid-1/#grid-item Referenced in:

- 2.2. Scrollable Overflow

https://html.spec.whatwg.org/multipage/sections.html#the-body-element Referenced in:

- 3.4. Overflow Viewport Propagation

https://html.spec.whatwg.org/multipage/semantics.html#the-html-element Referenced in:

- 3.4. Overflow Viewport Propagation

https://drafts.csswg.org/mediaqueries-4/#valdef-media-print Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties

### Terms defined by reference

- [CSS-ALIGN-3] defines the following terms:
  - align-content
  - content-distribution properties
  - justify-content
  - normal
  - place-content
- [CSS-BACKGROUNDS-3] defines the following terms:
  - box-shadow
- [CSS-BREAK-3] defines the following terms:
  - break-after
  - break-before
  - break-inside
  - orphans
- [css-break-4] defines the following terms:
  - forced break
  - fragmentation break
  - fragmentation container
  - fragmentation context
  - fragmentation direction
  - fragmented flow
  - region break
  - unforced break
  - widows
- [css-cascade-4] defines the following terms:
  - shorthand
- [css-contain-1] defines the following terms:
  - contain
- [css-display-3] defines the following terms:
  - block box
  - block container
  - block formatting context
  - containing block chain
  - display
  - establish an independent formatting context
  - establishes an independent formatting context
  - in-flow
  - independent formatting context
- [css-inline-3] defines the following terms:
  - root inline box
- [CSS-MASKING-1] defines the following terms:
  - clip
  - clip-path
- [css-multicol-1] defines the following terms:
  - multi-column container
  - multicol container
  - overflow columns
- [css-pseudo-4] defines the following terms:
  - ::first-letter
  - ::first-line
- [css-sizing-3] defines the following terms:
  - max-content
  - max-content size
  - min-content inline size
  - min-content size
- [css-syntax-3] defines the following terms:
  - ignored
- [CSS-TEXT-3] defines the following terms:
  - content language
  - overflow-wrap
  - soft wrap opportunity
- [css-text-decor-3] defines the following terms:
  - text-shadow
- [css-transforms-2] defines the following terms:
  - 3d rendering context
  - transform-style
- [css-values-3] defines the following terms:
  - <integer>
  - <string>
- [css-values-4] defines the following terms:
  - ?
  - {a,b}
  - |
- [css-writing-modes-3] defines the following terms:
  - direction
  - left
  - unicode-bidi
- [css-writing-modes-4] defines the following terms:
  - block size
  - block-start
  - end
  - inline size
  - inline-start
  - principal writing mode
  - writing mode
  - writing-mode
- [CSS21] defines the following terms:
  - line-height
  - positioned
  - strut
- [CSS3-BOX] defines the following terms:
  - padding edge
- [CSS3-FLEXBOX] defines the following terms:
  - flex item
- [CSS3-GRID-LAYOUT] defines the following terms:
  - grid item
- [HTML] defines the following terms:
  - body
  - html
- [mediaqueries-4] defines the following terms:
  - print

## References

### Normative References

[CSS-ALIGN-3]
  Elika Etemad; Tab Atkins Jr.. CSS Box Alignment Module Level 3. 6 December 2018. WD. URL: https://www.w3.org/TR/css-align-3/
[CSS-BACKGROUNDS-3]
  Bert Bos; Elika Etemad; Brad Kemper. CSS Backgrounds and Borders Module Level 3. 17 October 2017. CR. URL: https://www.w3.org/TR/css-backgrounds-3/
[CSS-BREAK-3]
  Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 3. 4 December 2018. CR. URL: https://www.w3.org/TR/css-break-3/
[CSS-BREAK-4]
  Rossen Atanassov; Elika Etemad. CSS Fragmentation Module Level 4. 18 December 2018. WD. URL: https://www.w3.org/TR/css-break-4/
[CSS-CASCADE-4]
  Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 28 August 2018. CR. URL: https://www.w3.org/TR/css-cascade-4/
[CSS-CONTAIN-1]
  Tab Atkins Jr.; Florian Rivoal. CSS Containment Module Level 1. 30 April 2019. CR. URL: https://www.w3.org/TR/css-contain-1/
[CSS-DISPLAY-3]
  Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 28 August 2018. CR. URL: https://www.w3.org/TR/css-display-3/
[CSS-INLINE-3]
  Dave Cramer; Elika Etemad; Steve Zilles. CSS Inline Layout Module Level 3. 8 August 2018. WD. URL: https://www.w3.org/TR/css-inline-3/
[CSS-MASKING-1]
  Dirk Schulze; Brian Birtles; Tab Atkins Jr.. CSS Masking Module Level 1. 26 August 2014. CR. URL: https://www.w3.org/TR/css-masking-1/
[CSS-MULTICOL-1]
  Florian Rivoal; Rachel Andrew. CSS Multi-column Layout Module Level 1. 28 May 2018. WD. URL: https://www.w3.org/TR/css-multicol-1/
[CSS-PSEUDO-4]
  Daniel Glazman; Elika Etemad; Alan Stearns. CSS Pseudo-Elements Module Level 4. 25 February 2019. WD. URL: https://www.w3.org/TR/css-pseudo-4/
[CSS-SIZING-3]
  Tab Atkins Jr.; Elika Etemad. CSS Intrinsic & Extrinsic Sizing Module Level 3. 22 May 2019. WD. URL: https://www.w3.org/TR/css-sizing-3/
[CSS-SYNTAX-3]
  Tab Atkins Jr.; Simon Sapin. CSS Syntax Module Level 3. 20 February 2014. CR. URL: https://www.w3.org/TR/css-syntax-3/
[CSS-TEXT-3]
  Elika Etemad; Koji Ishii; Florian Rivoal. CSS Text Module Level 3. 12 December 2018. WD. URL: https://www.w3.org/TR/css-text-3/
[CSS-TEXT-DECOR-3]
  Elika Etemad; Koji Ishii. CSS Text Decoration Module Level 3. 3 July 2018. CR. URL: https://www.w3.org/TR/css-text-decor-3/
[CSS-TRANSFORMS-2]
  CSS Transforms Module Level 2 URL: https://drafts.csswg.org/css-transforms-2/
[CSS-VALUES-3]
  Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 31 January 2019. CR. URL: https://www.w3.org/TR/css-values-3/
[CSS-VALUES-4]
  Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 4. 31 January 2019. WD. URL: https://www.w3.org/TR/css-values-4/
[CSS-WRITING-MODES-3]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 3. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-3/
[CSS-WRITING-MODES-4]
  Elika Etemad; Koji Ishii. CSS Writing Modes Level 4. 24 May 2018. CR. URL: https://www.w3.org/TR/css-writing-modes-4/
[CSS21]
  Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. REC. URL: https://www.w3.org/TR/CSS2/
[CSS3-BOX]
  Elika Etemad. CSS Box Model Module Level 3. 18 December 2018. WD. URL: https://www.w3.org/TR/css-box-3/
[CSS3-FLEXBOX]
  Tab Atkins Jr.; et al. CSS Flexible Box Layout Module Level 1. 19 November 2018. CR. URL: https://www.w3.org/TR/css-flexbox-1/
[CSS3-GRID-LAYOUT]
  Tab Atkins Jr.; Elika Etemad; Rossen Atanassov. CSS Grid Layout Module Level 1. 14 December 2017. CR. URL: https://www.w3.org/TR/css-grid-1/
[CSS3-TRANSFORMS]
  Simon Fraser; et al. CSS Transforms Module Level 1. 14 February 2019. CR. URL: https://www.w3.org/TR/css-transforms-1/
[HTML]
  Anne van Kesteren; et al. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[MEDIAQUERIES-4]
  Florian Rivoal; Tab Atkins Jr.. Media Queries Level 4. 5 September 2017. CR. URL: https://www.w3.org/TR/mediaqueries-4/
[RFC2119]
  S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[UAX29]
  Mark Davis. Unicode Text Segmentation. 15 February 2019. Unicode Standard Annex #29. URL: https://www.unicode.org/reports/tr29/tr29-35.html

### Informative References

[CSS-PAGE-3]
  Elika Etemad; Simon Sapin. CSS Paged Media Module Level 3. 18 October 2018. WD. URL: https://www.w3.org/TR/css-page-3/
[CSS-REGIONS-1]
  Rossen Atanassov; Alan Stearns. CSS Regions Module Level 1. 9 October 2014. WD. URL: https://www.w3.org/TR/css-regions-1/
[CSS-UI-3]
  Tantek Çelik; Florian Rivoal. CSS Basic User Interface Module Level 3 (CSS3 UI). 21 June 2018. REC. URL: https://www.w3.org/TR/css-ui-3/
[CSS1]
  Håkon Wium Lie; Bert Bos. Cascading Style Sheets, level 1. 13 September 2018. REC. URL: https://www.w3.org/TR/CSS1/
[CSSOM-VIEW]
  Simon Pieters. CSSOM View Module. 17 March 2016. WD. URL: https://www.w3.org/TR/cssom-view-1/

## Property Index

Name | Value | Initial | Applies to | Inh. | %ages | Animation type | Canonical order | Computed value
--- | --- | --- | --- | --- | --- | --- | --- | ---
block-ellipsis | none | auto | <string> | none | block containers | yes | N/A | discrete | per grammar | specified value
continue | auto | discard | auto | block containers and multicol containers | no | N/A | discrete | per grammar | specified keyword
line-clamp | none | <integer> <'block-ellipsis'>? | none | see individual properties | see individual properties | N/A | see individual properties | per grammar | see individual properties
max-lines | none | <integer> | none | block containers which are also fragmentation containers that capture region breaks | no | N/A | by computed value type | per grammar | the keyword none or an integer
overflow | [ visible | hidden | clip | scroll | auto ]{1,2} | visible | block containers [CSS21], flex containers [CSS3-FLEXBOX], and grid containers [CSS3-GRID-LAYOUT] | no | N/A | discrete | per grammar | see individual properties
overflow-block | <'overflow'> | visible | Same as overflow-x and overflow-y | no | N/A | discrete | per grammar | Same as overflow-x and overflow-y
overflow-inline | <'overflow'> | visible | Same as overflow-x and overflow-y | no | N/A | discrete | per grammar | Same as overflow-x and overflow-y
overflow-x | visible | hidden | clip | scroll | auto | visible | block containers [CSS21], flex containers [CSS3-FLEXBOX], and grid containers [CSS3-GRID-LAYOUT] | no | N/A | discrete | per grammar | as specified, except with visible/clip computing to auto/hidden (respectively) if one of overflow-x or overflow-y is neither visible nor clip
overflow-y | visible | hidden | clip | scroll | auto | visible | block containers [CSS21], flex containers [CSS3-FLEXBOX], and grid containers [CSS3-GRID-LAYOUT] | no | N/A | discrete | per grammar | as specified, except with visible/clip computing to auto/hidden (respectively) if one of overflow-x or overflow-y is neither visible nor clip
text-overflow | clip | ellipsis | clip | block containers | no | N/A | discrete | per grammar | specified keyword

## Issues Index

There’s disagreement on the scrolling model. 2.1 apparently defined that you scrolled the *content* area; the content would overflow the content-box, and you would union that overflow with the content box to find the scrollable area. In particular, this means that the content would be offset by the start-sides padding, but if it overflowed, it would go right to the edge on the end sides. This is what Firefox and IE do.

At least some authors (and spec authors) instead have the mental model that the padding box is what’s scrollable, so when you scroll to the end of the overflow, there’s the right/bottom padding. Chrome/WebKit do this for the block axis, at least. They’re somewhat inconsistent for the inline axis; there’s something weird about how they handle lineboxes.

It seems that the block-axis padding is probably web-compatible to honor. It’s unclear that the inline-axis padding will be. Further experimentation is needed.

↵
Is this description of handling transforms sufficiently accurate? ↵
should overflow: clip also clip the scrollable overflow or should it remain a pure paint-time operation, which would mean that scrollable overflow, while invisible, would still be scrollable. ↵
Need to evaluate compat of honoring or ignoring clip and clip-path. ↵
It’s not yet clear if including the end-side padding in the scrollable layer of block containers is Web-compatible, so this clause is under investigation. It appears that Chrome and Safari include such padding in the block axis; and the behavior in the inline axis is not clear. <https://github.com/w3c/csswg-drafts/issues/129> ↵
This needs further testing and investigation; is therefore deferred in this draft. ↵
import examples from [CSS3-BOX]. ↵
Should this apply to other types of fragmentation breaks (e.g. pages, columns)? ↵
For the time being, experiemental implementations are encouraged to follow the full behavior defined by this shorthand and its longhands, but to only expose the shorthand to authors. This is in order to facilitate further tweaking, and in particular potential renaming, of the longhand properties and their values. ↵
This property is meant to generalize and replace the `region-fragment` property from [CSS-REGIONS-1]. Once it is sufficiently stable in this specification, `region-fragment` should be removed from the regions specification in favor of this. ↵
Make sure effects on OM are well defined <https://github.com/w3c/csswg-drafts/issues/2970> ↵
Are we sure about that? Discussions in the Syndey F2F meeting seemed to generally converge on this, but other possibilities were raised. <https://github.com/w3c/csswg-drafts/issues/2971> ↵
#overflow Referenced in:

- 2. Types of Overflow (2)
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2)

#ink-overflow Referenced in:

- 2. Types of Overflow
- 2.1. Ink Overflow (2)
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties

#ink-overflow-region Referenced in:

- 2.1. Ink Overflow

#ink-overflow-rectangle Referenced in:

- 2.1. Ink Overflow

#scrollable-overflow Referenced in:

- 2. Types of Overflow
- 2.2. Scrollable Overflow (2) (3)
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 3.3. Scrolling Origin, Direction, and Restriction
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

#scrollable-overflow-region Referenced in:

- 2.1. Ink Overflow
- 2.2. Scrollable Overflow (2) (3) (4)
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2)
- 3.3. Scrolling Origin, Direction, and Restriction (2)

#scrollable-overflow-rectangle Referenced in:

- 2.2. Scrollable Overflow (2)

#scroll-container Referenced in:

- 2.2. Scrollable Overflow
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4) (5)
- 3.1. Overflow in Print and Other Static Media
- 3.3. Scrolling Origin, Direction, and Restriction

#propdef-overflow-x Referenced in:

- 1. Introduction
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4)
- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties (2) (3)

#propdef-overflow-y Referenced in:

- 1. Introduction
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4)
- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties (2) (3)

#propdef-overflow Referenced in:

- 1. Introduction
- 2.2. Scrollable Overflow (2)
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4) (5) (6)
- 3.1. Overflow in Print and Other Static Media
- 3.4. Overflow Viewport Propagation (2)
- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties
- 4.1. Overflow Ellipsis: the text-overflow property
- 5.3. Fragmentation of Overflow: the continue property (2) (3)

#valdef-overflow-visible Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4)
- 3.4. Overflow Viewport Propagation (2) (3)
- 4.1. Overflow Ellipsis: the text-overflow property

#valdef-overflow-hidden Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3) (4)
- 3.1. Overflow in Print and Other Static Media
- 3.4. Overflow Viewport Propagation

#valdef-overflow-clip Referenced in:

- 1. Introduction
- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties (2) (3)
- 3.4. Overflow Viewport Propagation

#valdef-overflow-scroll Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 3.1. Overflow in Print and Other Static Media

#valdef-overflow-auto Referenced in:

- 3. Scrolling and Clipping Overflow: the overflow-x, overflow-y, and overflow properties
- 3.1. Overflow in Print and Other Static Media
- 3.4. Overflow Viewport Propagation

#propdef-overflow-inline Referenced in:

- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties

#propdef-overflow-block Referenced in:

- 3.5. Flow Relative Properties: the overflow-block and overflow-inline properties

#propdef-text-overflow Referenced in:

- 1. Introduction (2)
- 4.1. Overflow Ellipsis: the text-overflow property
- ellipsing details
- user interaction with ellipsis (2)
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property

#propdef-block-ellipsis Referenced in:

- 1. Introduction
- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2) (3)
- 5.1. Limiting Visible Lines: the line-clamp shorthand property (2) (3) (4)
- 5.1.1. Legacy compatibility (2) (3)

#block-overflow-ellipsis Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13)

#valdef-block-ellipsis-none Referenced in:

- 4.2. Indicating Block-Axis Overflow: the block-ellipsis property (2)
- 5.1. Limiting Visible Lines: the line-clamp shorthand property

#valdef-block-ellipsis-auto Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property
- 5.1.1. Legacy compatibility

#propdef-line-clamp Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property (2)
- 5.1.1. Legacy compatibility (2)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property

#valdef-line-clamp-none Referenced in:

- 5.1.1. Legacy compatibility

#propdef--webkit-line-clamp Referenced in:

- 5.1.1. Legacy compatibility

#valdef-continue--webkit-discard Referenced in:

- 5.1.1. Legacy compatibility

#propdef-max-lines Referenced in:

- 1. Introduction
- 5.1. Limiting Visible Lines: the line-clamp shorthand property (2) (3)
- 5.1.1. Legacy compatibility (2)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property (2) (3) (4) (5) (6)
- 5.3. Fragmentation of Overflow: the continue property

#valdef-max-lines-none Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property (2) (3)

#propdef-continue Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property (2) (3)
- 5.1.1. Legacy compatibility (2) (3)
- 5.2. Forcing a Break After a Set Number of Lines: the max-lines property
- 5.3. Fragmentation of Overflow: the continue property (2) (3) (4) (5)

#valdef-continue-auto Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property
- 5.3. Fragmentation of Overflow: the continue property

#valdef-continue-discard Referenced in:

- 5.1. Limiting Visible Lines: the line-clamp shorthand property
- 5.1.1. Legacy compatibility (2)