# CSS Containment Module Level 1

## Editor’s Draft, 5 September 2019

Specification Metadata

This version:
  https://drafts.csswg.org/css-contain/
Latest published version:
  https://www.w3.org/TR/css-contain-1/
Previous Versions:
  https://www.w3.org/TR/2019/CR-css-contain-1-20190430/
  https://www.w3.org/TR/2018/CR-css-contain-1-20181108/
  https://www.w3.org/TR/2018/CR-css-contain-1-20180524/
  https://www.w3.org/TR/2017/CR-css-contain-1-20170808/
  https://www.w3.org/TR/2017/WD-css-contain-1-20170419/
  https://www.w3.org/TR/2017/WD-css-contain-1-20170221/
Test Suite:
  http://test.csswg.org/suites/css-contain-1_dev/nightly-unstable/
Editors:
  Tab Atkins (Google)
  Florian Rivoal (On behalf of Bloomberg)
Suggest an Edit for this Spec:
  GitHub Editor
Issue Tracking:
  GitHub Issues

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

## Abstract

This CSS module describes the contain property, which indicates that the element’s subtree is independent of the rest of the page. This enables heavy optimizations by user agents when used well.

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-contain” in the title, preferably like this: “[css-contain] …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.

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

- style containment and the contain: style value

“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

Efficiently rendering a website relies on the User Agent being able to detect what parts of the page are being displayed, which parts might affect the currently-displayed section, and what can be ignored.

There are various heuristics that can be used to guess when a given sub-tree is independent of the rest of the page in some manner, but they’re fragile, so innocuous changes to a page may inadvertently make it flunk the heuristics and fall into a slow mode. There are also many things that would be good to isolate which are difficult or impossible to detect in a heuristic manner.

To alleviate these problems and allow strong, predictable isolation of a subtree from the rest of the page, this specification defines a contain property.

## 2. Strong Containment: the contain property

Name: | contain
Value: | none | strict | content | [ size || layout || style || paint ]
Initial: | none
Applies to: | See below
Inherited: | no
Percentages: | n/a
Computed value: | specified keyword(s)
Canonical order: | per grammar
Animation type: | not animatable

- contain-animation-001.html (live test) (source)
- inheritance.html (live test) (source)
- contain-computed.html (live test) (source)
- contain-invalid.html (live test) (source)
- contain-valid.html (live test) (source)
- contain-layout-size-003.html (live test) (source)
- contain-paint-size-001.html (live test) (source)
- contain-paint-size-002.html (live test) (source)
- contain-paint-size-003.html (live test) (source)
- contain-chrome-crash-001.html (live test) (source)

User Agents are expected to support this property on all media, including non-visual ones.

The contain property allows an author to indicate that an element and its contents are, as much as possible, independent of the rest of the document tree. This allows user agents to utilize much stronger optimizations when rendering a page using contain properly, and allows authors to be confident that their page won’t accidentally fall into a slow code path due to an innocuous change.

none
  This value indicates that the property has no effect. The element renders as normal, with no containment effects applied.
strict
  This value turns on all forms of containment except style containment for the element. In other words, it behaves the same as contain: size layout paint;.
  - contain-strict-001.html (live test) (source)
  - contain-strict-002.html (live test) (source)
  - contain-strict-003.html (live test) (source)
  - contain-strict-011.html (live test) (source)
content
  This value turns on all forms of containment except size containment and style containment for the element. In other words, it behaves the same as contain: layout paint;.
  - contain-content-001.html (live test) (source)
  - contain-content-002.html (live test) (source)
  - contain-content-003.html (live test) (source)
  - contain-content-004.html (live test) (source)
  - contain-content-011.html (live test) (source)

  Note: contain: content is reasonably "safe" to apply widely; its effects are fairly minor in practice, and most content won’t run afoul of its restrictions. However, because it doesn’t apply size containment, the element can still respond to the size of its contents, which can cause layout-invalidation to percolate further up the tree than desired. Use contain: strict or contain: strict style when possible, to gain as much containment as you can.

size
  The value turns on size containment for the element. This ensures that the containing box can be laid out without needing to examine its descendants.
  - contain-size-001.html (live test) (source)
  - contain-size-002.html (live test) (source)
  - contain-size-003.html (live test) (source)
  - contain-size-004.html (live test) (source)
  - contain-size-005.html (live test) (source)
  - contain-size-006.html (live test) (source)
  - contain-size-007.html (live test) (source)
  - contain-size-008.html (live test) (source)
  - contain-size-009.html (live test) (source)
  - contain-size-010.html (live test) (source)
  - contain-size-011.html (live test) (source)
  - contain-size-012.html (live test) (source)
  - contain-size-012b.html (live test) (source)
  - contain-size-013.html (live test) (source)
  - contain-size-021.html (live test) (source)
  - contain-size-023.html (live test) (source)
  - contain-size-025.html (live test) (source)
  - contain-size-027.html (live test) (source)
  - contain-size-041.html (live test) (source)
  - contain-size-042.html (live test) (source)
  - contain-size-051.html (live test) (source)
  - contain-size-052.html (live test) (source)
  - contain-size-056.html (live test) (source)
  - contain-size-061.html (live test) (source)
  - contain-size-062.html (live test) (source)
  - contain-size-baseline-001.html (live test) (source)
  - contain-size-borders.html (live test) (source)
  - contain-size-breaks-001.html (live test) (source)
  - contain-size-button-001.html (live test) (source)
  - contain-size-fieldset-001.html (live test) (source)
  - contain-size-fieldset-002.html (live test) (source)
  - contain-size-flexbox-001.html (live test) (source)
  - contain-size-flexbox-002.html (live test) (source)
  - contain-size-grid-001.html (live test) (source)
  - contain-size-grid-002.html (live test) (source)
  - contain-size-monolithic-001.html (live test) (source)
  - contain-size-multicol-001.html (live test) (source)
  - contain-size-multicol-as-flex-item.html (live test) (source)
  - contain-size-replaced-001.html (live test) (source)
  - contain-size-replaced-002.html (live test) (source)
  - contain-size-replaced-003a.html (live test) (source)
  - contain-size-replaced-003b.html (live test) (source)
  - contain-size-replaced-003c.html (live test) (source)
  - contain-size-replaced-004.html (live test) (source)
  - contain-size-replaced-005.html (live test) (source)
  - contain-size-replaced-006.html (live test) (source)
  - contain-size-select-001.html (live test) (source)
  - contain-size-select-002.html (live test) (source)
  - contain-size-scrollbars-001.html (live test) (source)
  - contain-size-scrollbars-002.html (live test) (source)
  - contain-size-scrollbars-003.html (live test) (source)
  - contain-layout-size-003.html (live test) (source)
  - contain-paint-size-001.html (live test) (source)
  - contain-paint-size-002.html (live test) (source)
  - contain-paint-size-003.html (live test) (source)
layout
  This value turns on layout containment for the element. This ensures that the containing box is totally opaque for layout purposes; nothing outside can affect its internal layout, and vice versa.
  - contain-layout-001.html (live test) (source)
  - contain-layout-002.html (live test) (source)
  - contain-layout-003.html (live test) (source)
  - contain-layout-004.html (live test) (source)
  - contain-layout-005.html (live test) (source)
  - contain-layout-006.html (live test) (source)
  - contain-layout-007.html (live test) (source)
  - contain-layout-009.html (live test) (source)
  - contain-layout-010.html (live test) (source)
  - contain-layout-011.html (live test) (source)
  - contain-layout-012.html (live test) (source)
  - contain-layout-013.html (live test) (source)
  - contain-layout-014.html (live test) (source)
  - contain-layout-016.html (live test) (source)
  - contain-layout-017.html (live test) (source)
  - contain-layout-018.html (live test) (source)
  - contain-layout-baseline-001.html (live test) (source)
  - contain-layout-baseline-002.html (live test) (source)
  - contain-layout-baseline-003.html (live test) (source)
  - contain-layout-baseline-004.html (live test) (source)
  - contain-layout-baseline-005.html (live test) (source)
  - contain-layout-breaks-001.html (live test) (source)
  - contain-layout-breaks-002.html (live test) (source)
  - contain-layout-button-001.html (live test) (source)
  - contain-layout-cell-001.html (live test) (source)
  - contain-layout-cell-002.html (live test) (source)
  - contain-layout-flexbox-001.html (live test) (source)
  - contain-layout-grid-001.html (live test) (source)
  - contain-layout-ifc-022.html (live test) (source)
  - contain-layout-independent-formatting-context-001.html (live test) (source)
  - contain-layout-independent-formatting-context-002.html (live test) (source)
  - contain-layout-independent-formatting-context-003.html (live test) (source)
  - contain-layout-ink-overflow-013.html (live test) (source)
  - contain-layout-ink-overflow-014.html (live test) (source)
  - contain-layout-ink-overflow-015.html (live test) (source)
  - contain-layout-ink-overflow-016.html (live test) (source)
  - contain-layout-ink-overflow-017.html (live test) (source)
  - contain-layout-ink-overflow-018.html (live test) (source)
  - contain-layout-ink-overflow-019.html (live test) (source)
  - contain-layout-ink-overflow-020.html (live test) (source)
  - contain-layout-size-003.html (live test) (source)
  - contain-subgrid-001.html (live test) (source)
style
  This value turns on style containment for the element. This ensures that, for properties which can have effects on more than just an element and its descendants, those effects don’t escape the element.
  - contain-style-baseline-001.html (live test) (source)
  - contain-style-breaks-001.html (live test) (source)
  - contain-style-breaks-002.html (live test) (source)
  - contain-style-breaks-003.html (live test) (source)
  - contain-style-breaks-004.html (live test) (source)
  - contain-style-breaks-005.html (live test) (source)
  - contain-style-counters-001.html (live test) (source)
  - contain-style-counters-002.html (live test) (source)
  - contain-style-counters-003.html (live test) (source)
  - contain-style-counters-004.html (live test) (source)
  - counter-scoping-001.html (live test) (source)
  - counter-scoping-002.html (live test) (source)
  - counter-scoping-003.html (live test) (source)
  - quote-scoping-001.html (live test) (source)
  - quote-scoping-002.html (live test) (source)
  - quote-scoping-003.html (live test) (source)
  - quote-scoping-004.html (live test) (source)

  Note: This value is at-risk.

paint
  This value turns on paint containment for the element. This ensures that the descendants of the containing box don’t display outside its bounds, so if an element is off-screen or otherwise not visible, its descendants are also guaranteed to be not visible.
  - contain-paint-001.html (live test) (source)
  - contain-paint-002.html (live test) (source)
  - contain-paint-004.html (live test) (source)
  - contain-paint-005.html (live test) (source)
  - contain-paint-006.html (live test) (source)
  - contain-paint-007.html (live test) (source)
  - contain-paint-008.html (live test) (source)
  - contain-paint-009.html (live test) (source)
  - contain-paint-010.html (live test) (source)
  - contain-paint-011.html (live test) (source)
  - contain-paint-012.html (live test) (source)
  - contain-paint-014.html (live test) (source)
  - contain-paint-015.html (live test) (source)
  - contain-paint-016.html (live test) (source)
  - contain-paint-017.html (live test) (source)
  - contain-paint-018.html (live test) (source)
  - contain-paint-019.html (live test) (source)
  - contain-paint-020.html (live test) (source)
  - contain-paint-021.html (live test) (source)
  - contain-paint-022.html (live test) (source)
  - contain-paint-023.html (live test) (source)
  - contain-paint-024.html (live test) (source)
  - contain-paint-025.html (live test) (source)
  - contain-paint-047.html (live test) (source)
  - contain-paint-048.html (live test) (source)
  - contain-paint-baseline-001.html (live test) (source)
  - contain-paint-cell-001.html (live test) (source)
  - contain-paint-cell-002.html (live test) (source)
  - contain-paint-clip-011.html (live test) (source)
  - contain-paint-clip-012.html (live test) (source)
  - contain-paint-clip-013.html (live test) (source)
  - contain-paint-clip-014.html (live test) (source)
  - contain-paint-clip-015.html (live test) (source)
  - contain-paint-clip-016.html (live test) (source)
  - contain-paint-clip-017.html (live test) (source)
  - contain-paint-clip-018.html (live test) (source)
  - contain-paint-clip-019.html (live test) (source)
  - contain-paint-ifc-011.html (live test) (source)
  - contain-paint-independent-formatting-context-001.html (live test) (source)
  - contain-paint-independent-formatting-context-002.html (live test) (source)
  - contain-paint-independent-formatting-context-003.html (live test) (source)
  - contain-paint-size-001.html (live test) (source)
  - contain-paint-size-002.html (live test) (source)
  - contain-paint-size-003.html (live test) (source)
  - contain-paint-table-001.html (live test) (source)
  - contain-paint-table-002.html (live test) (source)
  - contain-subgrid-001.html (live test) (source)

This property generally applies to all elements (including CSS Pseudo-Elements 4 §4.1 Generated Content Pseudo-elements: ::before and ::after), although some types of containment have no effect on some elements, as detailed in § 3 Types of Containment. In addition, in the case of [SVG2], the contain property only applies to `svg` elements that have an associated CSS layout box.

contain is useful when used widely on a page, particularly when a page contains a lot of "widgets" which are all independent.

For example, assume a micropost social network had markup something like this:

    <body>
      <aside>...</aside>
      <section>
        <h2>Messages</h2>
        <article>
          Lol, check out this dog: images.example.com/jsK3jkl
        </article>
        <article>
          I had a ham sandwich today. #goodtimes
        </article>
        <article>
          I have political opinions that you need to hear!
        </article>
        …
      </section>
    </body>

There are probably a lot of messages displayed on the site, but each is independent and won’t affect anything else on the site. As such, each can be marked with contain: content to communicate this to the user agent, so it can optimize the page and skip a lot of computation for messages that are off-screen. If the size of each message is known ahead of time, contain: strict can be applied to communicate further restrictions.

## 3. Types of Containment

There are several varieties of containment that an element can be subject to, restricting the effects that its descendants can have on the rest of the page in various ways. Containment enables much more powerful optimizations by user agents, and helps authors compose their page out of functional units, as it limits how widely a given change can affect a document.

Specification authors introducing new properties or mechanisms need to consider whether and how the various types of containment affect what they are introducing, and include in their specification any effect not described here.

### 3.1. Size Containment

If the element does not generate a principal box (as is the case with display: contents or display: none), or its inner display type is table, or its principal box is an internal table box, or an internal ruby box, or a non-atomic inline-level box, size containment has no effect. Otherwise, giving an element size containment makes its principal box a containing box for size containment and has the following effects:

- contain-size-001.html (live test) (source)
- contain-size-002.html (live test) (source)
- contain-size-003.html (live test) (source)
- contain-size-004.html (live test) (source)
- contain-size-005.html (live test) (source)
- contain-size-006.html (live test) (source)
- contain-size-007.html (live test) (source)
- contain-size-008.html (live test) (source)
- contain-size-009.html (live test) (source)
- contain-size-010.html (live test) (source)
- contain-size-012.html (live test) (source)
- contain-size-012b.html (live test) (source)
- contain-size-051.html (live test) (source)
- contain-size-052.html (live test) (source)

Note: Internal table boxes, which do not include table captions, are excluded, because the table layout algorithm does not allow boxes to become smaller than their inflow content. Sizing a table cell as if it was empty and then layout out its content inside without changing the size is effectively an undefined operation. Manually setting the width or height properties to 0 cannot make it smaller than its content. This concern does not apply to table captions, which are perfectly capable of having a fixed size that is independent of their content.

- contain-size-011.html (live test) (source)
- contain-size-056.html (live test) (source)

1. When calculating the size of the containing box, it must be treated as having no contents.

   - contain-size-021.html (live test) (source)
   - contain-size-023.html (live test) (source)
   - contain-size-025.html (live test) (source)
   - contain-size-027.html (live test) (source)
   - contain-size-061.html (live test) (source)
   - contain-size-062.html (live test) (source)
   - contain-size-borders.html (live test) (source)
   - contain-size-fieldset-001.html (live test) (source)
   - contain-size-fieldset-002.html (live test) (source)
   - contain-size-select-001.html (live test) (source)
   - contain-size-select-002.html (live test) (source)
   - contain-size-scrollbars-001.html (live test) (source)
   - contain-size-scrollbars-002.html (live test) (source)
   - contain-size-scrollbars-003.html (live test) (source)
   - contain-size-button-001.html (live test) (source)
   - contain-size-flexbox-001.html (live test) (source)
   - contain-size-flexbox-002.html (live test) (source)
   - contain-size-grid-001.html (live test) (source)

   Note: Even when the element’s sizing properties are auto this does not necessarily make the element zero-sized: properties set on the element itself, such as the columns property or the grid property, continue to be taken into account.

   - contain-size-grid-002.html (live test) (source)
   - contain-size-grid-003.html (live test) (source)
   - contain-size-multicol-001.html (live test) (source)
   - contain-size-multicol-as-flex-item.html (live test) (source)

   Then, its contents must then be laid out into the containing box's resolved size.

   Note: size containment does not suppress baseline alignment. See layout containment for that.

   - contain-size-baseline-001.html (live test) (source)

   Replaced elements must be treated as having an intrinsic width and height of 0.

   - contain-size-013.html (live test) (source)
   - contain-size-041.html (live test) (source)
   - contain-size-042.html (live test) (source)
   - contain-size-replaced-001.html (live test) (source)
   - contain-size-replaced-002.html (live test) (source)
   - contain-size-replaced-003a.html (live test) (source)
   - contain-size-replaced-003b.html (live test) (source)
   - contain-size-replaced-003c.html (live test) (source)
   - contain-size-replaced-004.html (live test) (source)
   - contain-size-replaced-005.html (live test) (source)
   - contain-size-replaced-006.html (live test) (source)

2. Containing boxes for size containment are monolithic (See CSS Fragmentation Module Level 3 §possible-breaks).

   - contain-size-breaks-001.html (live test) (source)
   - contain-size-monolithic-001.html (live test) (source)

By itself, size containment does not offer much optimization opportunity. Its primary benefit on its own is that tools which want to lay out the containing box’s contents based on the containing box’s size (such as a JS library implementing the "container query" concept) can do so without fear of "infinite loops", where having a child’s size respond to the size of the containing box causes the containing box’s size to change as well, possibly triggering further changes in how the child sizes itself and possibly thus more changes to the containing box’s size, ad infinitum.

When paired with layout containment, though, possible optimizations that can be enabled include (but are not limited to):

1. When the style or contents of a descendant of the containing box is changed, calculating what part of the DOM tree is "dirtied" and might need to be re-laid out can stop at the containing box.

2. When laying out the page, if the containing box is off-screen or obscured, the layout of its contents can be delayed or done at a lower priority.

### 3.2. Layout Containment

If the element does not generate a principal box (as is the case with display values of contents or none), or its principal box is an internal table box other than table-cell, or an internal ruby box, or a non-atomic inline-level box, layout containment has no effect. Otherwise, giving an element layout containment makes its principal box a containing box for layout containment and has the following effects:

- contain-layout-001.html (live test) (source)
- contain-layout-002.html (live test) (source)
- contain-layout-003.html (live test) (source)
- contain-layout-004.html (live test) (source)
- contain-layout-005.html (live test) (source)
- contain-layout-009.html (live test) (source)
- contain-layout-010.html (live test) (source)
- contain-layout-011.html (live test) (source)
- contain-layout-012.html (live test) (source)
- contain-layout-013.html (live test) (source)
- contain-layout-014.html (live test) (source)
- contain-layout-independent-formatting-context-003.html (live test) (source)

1. The containing box establishes an independent formatting context.

   - contain-layout-ifc-022.html (live test) (source)
   - contain-layout-independent-formatting-context-001.html (live test) (source)
   - contain-layout-independent-formatting-context-002.html (live test) (source)
   - contain-subgrid-001.html (live test) (source)

2. If at least one fragmentation container of a fragmentation context has layout containment, or if at least one fragmentation container of a fragmentation context is a descendant of containing box for layout containment and at least one subsequent fragmentation container of the same fragmentation context is not a descendant of that same element with layout containment, then the first containing box for layout containment which is either a fragmentation container itself or is an ancestor of a fragmentation container must “trap” the remainder of the fragmented flow: fragmentation must not continue past the layout containment boundary, and the last fragmentation container within the first layout containment boundary is treated as if it is the last fragmentation container in its fragmentation context.

   If subsequent fragmentation containers in the fragmentation context are only generated when more content remains in the fragmented flow, then they are not generated. If they would exist regardless, they remain part of the fragmentation context, but do not receive any content from the fragmented flow.

   Note: At the time of writing, no stable specification is affected by this point. Only specifications that would enable some (but not all) fragmentation containers of a fragmentation context to be layout-contained (or descendants of a layout contained element) are concerned. This is not the case of [CSS-PAGE-3] nor of [CSS-MULTICOL-1]. This requirement is nonetheless included because several mechanisms that would make this a possibility have been considered (e.g.: [CSS-REGIONS-1], ::nth-fragment(), a hypothetical selector for individual columns of a multicol…), and the guarantees that layout containment is intended to offer would not be realized if such mechanisms did not abide by this rule. [CSS-REGIONS-1] has details over how layout containment affects regions.

       <article>Lorem ipsum…</article>
       <div id=a></div>
       <aside>
         <div id=b></div>
         <div id=c></div>
       </aside>
       <aside>
         <div id=d></div>
         <div id=e></div>
       </aside>
       <div id=f></div>

       article {flow-into: foo;}
       #a, #b, #c, #d, #e, #f {flow-from: foo;}
       aside {contain: layout}

   In this [CSS-REGIONS-1] example, content can flow from `#a` to `#b`, from `#b` to `#c`. However as `#c` is the last fragment container in the first containing box for layout containment, it traps all the remaining content, and nothing gets flowed into `#d`, `#e`, or `#f`.

3. If the computed value of the overflow property is either visible or clip or a combination thereof, any overflow must be treated as ink overflow.

   - contain-layout-ink-overflow-013.html (live test) (source)
   - contain-layout-ink-overflow-014.html (live test) (source)
   - contain-layout-ink-overflow-015.html (live test) (source)
   - contain-layout-ink-overflow-016.html (live test) (source)
   - contain-layout-ink-overflow-017.html (live test) (source)
   - contain-layout-ink-overflow-018.html (live test) (source)
   - contain-layout-ink-overflow-019.html (live test) (source)
   - contain-layout-ink-overflow-020.html (live test) (source)

4. The containing box acts as a containing block for absolutely positioned and fixed positioned descendants.

   - contain-layout-006.html (live test) (source)
   - contain-layout-007.html (live test) (source)
   - contain-layout-cell-001.html (live test) (source)
   - contain-layout-cell-002.html (live test) (source)

5. The containing box creates a stacking context.

   - contain-layout-016.html (live test) (source)
   - contain-layout-017.html (live test) (source)
   - contain-layout-018.html (live test) (source)

6. Forced breaks are allowed within containing boxes for layout containment, but do not propagate to the parent as otherwise described in CSS Fragmentation Module Level 3 §break-between.

   - contain-layout-breaks-001.html (live test) (source)
   - contain-layout-breaks-002.html (live test) (source)

   Note: This introduces the previously non-existent possibility that forced breaks may occur between a box and its container (See CSS Fragmentation Module Level 3 §possible-breaks).

7. For the purpose of the vertical-align property, or any other property whose effects need to relate the position of the containing box's baseline to something other than its descendants, the containing box is treated as having no baseline.

   - contain-layout-baseline-001.html (live test) (source)
   - contain-layout-button-001.html (live test) (source)
   - contain-layout-flexbox-001.html (live test) (source)
   - contain-layout-grid-001.html (live test) (source)
   - contain-layout-baseline-002.html (live test) (source)
   - contain-layout-baseline-003.html (live test) (source)
   - contain-layout-baseline-004.html (live test) (source)
   - contain-layout-baseline-005.html (live test) (source)

Possible optimizations that can be enabled by layout containment include (but are not limited to):

1. When laying out the page, the contents of separate containing boxes can be laid out in parallel, as they’re guaranteed not to affect each other.

2. When laying out the page, if the containing box is off-screen or obscured and the layout of the visible parts of the screen do not depend on the size of the containing box (for example, if the containing box is near the end of a block container, and you’re viewing the beginning of the block container), the layout of the containing box' contents can be delayed or done at a lower priority.

   (When paired with size containment, this optimization can be applied more liberally.)

### 3.3. Style Containment

Note: Style Containment is at-risk.

Giving an element style containment and has the following effects:

1. The counter-increment and counter-set properties must be scoped to the element’s sub-tree and create a new counter.

   - contain-style-counters-001.html (live test) (source)
   - contain-style-counters-002.html (live test) (source)
   - contain-style-counters-003.html (live test) (source)
   - contain-style-counters-004.html (live test) (source)

2. The effects of the content property’s open-quote, close-quote, no-open-quote and no-close-quote must be scoped to the element’s sub-tree.

   Note: This implies that the depth of quote nesting in the subtree is unchanged and starts at the value that its context normally implies, but that changes to the depth of quote nesting by these values inside the subtree do not affect the depth of quote nesting outside the subtree.

   - quote-scoping-001.html (live test) (source)
   - quote-scoping-002.html (live test) (source)
   - quote-scoping-003.html (live test) (source)
   - quote-scoping-004.html (live test) (source)

- contain-style-baseline-001.html (live test) (source)
- contain-style-breaks-001.html (live test) (source)
- contain-style-breaks-002.html (live test) (source)
- contain-style-breaks-003.html (live test) (source)
- contain-style-breaks-004.html (live test) (source)
- contain-style-breaks-005.html (live test) (source)

Note: [CSS-REGIONS-1] has normative requirements on how style containment affects regions.

A scoped property has its effects scoped to a particular element or subtree.

- If scoped to an element, it must act as if the scoping element was the root of the document for the purpose of evaluating the property’s effects: any uses of the property outside the scoping element must have no effect on the uses of the property on or in the scoping element, and vice versa.

  Note: “Scoping to an element” is currently unused. It is defined as an extension point for future specifications to use.

- If scoped to a sub-tree, it’s the same, except the scoping element itself is counted as "outside" the tree, like the rest of the document, and the effects of the property on that element are unaffected by scoping. When considering the effects of the scoped property on elements inside the subtree, the element at the base of the subtree is treated as if it was the root of the document.

  - counter-scoping-001.html (live test) (source)
  - counter-scoping-002.html (live test) (source)
  - counter-scoping-003.html (live test) (source)

As counter-increment is scoped to an element’s subtree, the first use of it within the subtree acts as if the named counter were set to 0 at the scoping element, regardless of whether the counter had been used outside the scoping element. Any increments made within the subtree have no effect on counters of the same name outside the scoping element. However, the counter() and counters() value of the content property is not itself scoped, and can refer to counters established outside of the subtree. Therefore, the following code results in `1 1.2` being displayed:

    <div></div>

    div {
      contain: style;
      counter-increment: n;
    }
    div::before, div::after {
      content: counters(n, '.') " ";
    }
    div::after {
      counter-increment: n 2;
    }

Possible optimizations that can be enabled by style containment include (but are not limited to):

1. Whenever a property is changed on a descendant of an element with style containment, calculating what part of the DOM tree is "dirtied" and might need to have its style recalculated can stop at the containing box.

### 3.4. Paint Containment

If the element does not generate a principal box (as is the case with display values of contents or none), or its principal box is an internal table box other than table-cell, or an internal ruby box, or a non-atomic inline-level box, paint containment has no effect. Otherwise, giving an element paint containment makes its principal box a containing box for paint containment and has the following effects:

- contain-paint-002.html (live test) (source)
- contain-paint-005.html (live test) (source)
- contain-paint-006.html (live test) (source)
- contain-paint-007.html (live test) (source)
- contain-paint-008.html (live test) (source)
- contain-paint-011.html (live test) (source)
- contain-paint-012.html (live test) (source)
- contain-paint-014.html (live test) (source)
- contain-paint-015.html (live test) (source)
- contain-paint-016.html (live test) (source)
- contain-paint-017.html (live test) (source)
- contain-paint-018.html (live test) (source)
- contain-paint-019.html (live test) (source)
- contain-paint-independent-formatting-context-003.html (live test) (source)

1. The contents of the element including both the paint of the descendants and their geometry must be clipped to the padding edge of the containing box, taking corner clipping into account. This does not include the creation of any mechanism to access or indicate the presence of the clipped content; nor does it inhibit the creation of any such mechanism through other properties, such as overflow, resize, or text-overflow. This is as if overflow: visible was changed to overflow: clip at used value.

   - contain-paint-001.html (live test) (source)
   - contain-paint-004.html (live test) (source)
   - contain-paint-047.html (live test) (source)
   - contain-paint-048.html (live test) (source)
   - contain-paint-cell-001.html (live test) (source)
   - contain-paint-cell-002.html (live test) (source)
   - contain-paint-clip-011.html (live test) (source)
   - contain-paint-clip-012.html (live test) (source)
   - contain-paint-clip-013.html (live test) (source)
   - contain-paint-clip-014.html (live test) (source)
   - contain-paint-clip-015.html (live test) (source)
   - contain-paint-clip-016.html (live test) (source)
   - contain-paint-clip-017.html (live test) (source)
   - contain-paint-clip-018.html (live test) (source)
   - contain-paint-clip-019.html (live test) (source)
   - contain-paint-table-001.html (live test) (source)
   - contain-paint-table-002.html (live test) (source)

2. The containing box acts as a containing block for absolutely positioned and fixed positioned descendants.

   - contain-paint-009.html (live test) (source)
   - contain-paint-010.html (live test) (source)
   - contain-paint-022.html (live test) (source)
   - contain-paint-023.html (live test) (source)
   - contain-paint-024.html (live test) (source)

3. The containing box creates a stacking context.

   - contain-paint-020.html (live test) (source)
   - contain-paint-021.html (live test) (source)
   - contain-paint-025.html (live test) (source)
   - contain-subgrid-001.html (live test) (source)

4. The containing box establishes an independent formatting context.

   - contain-paint-ifc-011.html (live test) (source)
   - contain-paint-independent-formatting-context-001.html (live test) (source)
   - contain-paint-independent-formatting-context-002.html (live test) (source)

- contain-paint-baseline-001.html (live test) (source)

Possible optimizations that can be enabled by paint containment include (but are not limited to):

1. If the containing box is off-screen or obscured, the UA can directly skip trying to paint its contents, as they’re guaranteed to be off-screen/obscured as well.

2. Unless the clipped content is made accessible via a separate mechanism such as the overflow, resize, or text-overflow properties, the UA can reserve "canvas" space for the box exactly the box’s size. (In similar, scrollable, situations, like overflow: hidden, it’s possible to scroll to the currently-clipped content, so UAs often predictively overpaint somewhat so there’s something to see as soon as the scroll happens, rather than a frame later.)

3. Because they are guaranteed to be stacking contexts, scrolling elements can be painted into a single GPU layer.

## 4. Privacy and Security Considerations

This specification introduces no new privacy or security considerations.

Like any other CSS specification, it affects the rendering of the document, but does not introduce any special ability to present content in a misleading way that was not previously available through other CSS modules and that isn’t inherent to the act of formatting the document.

The TAG has developed a self-review questionnaire to help editors and Working Groups evaluate the risks introduced by their specifications. Answers are provided below.

Does this specification deal with personally-identifiable information?
  No.
Does this specification deal with high-value data?
  No.
Does this specification introduce new state for an origin that persists across browsing sessions?
  No.
Does this specification expose persistent, cross-origin state to the web?
  No.
Does this specification expose any other data to an origin that it doesn’t currently have access to?
  No.
Does this specification enable new script execution/loading mechanisms?
  No.
Does this specification allow an origin access to a user’s location?
  No.
Does this specification allow an origin access to sensors on a user’s device?
  No.
Does this specification allow an origin access to aspects of a user’s local computing environment?
  No.
Does this specification allow an origin access to other devices?
  No.
Does this specification allow an origin some measure of control over a user agent’s native UI?
  No.
Does this specification expose temporary identifiers to the web?
  No.
Does this specification distinguish between behavior in first-party and third-party contexts?
  No.
How should this specification work in the context of a user agent’s "incognito" mode?
  No difference in behavior is needed.
Does this specification persist data to a user’s local device?
  No.
Does this specification have a "Security Considerations" and "Privacy Considerations" section?
  Yes, this is the section you are currently reading.
Does this specification allow downgrading default security characteristics?
  No.

## Appendix A. Changes

This appendix is informative.

### Changes from the Candidate Recommendation of 08 November 2018

A full Disposition of Comments is available.

- Exclude style containment from contain: strict and contain: content, and mark it at risk.

### Changes from the Candidate Recommendation of 24 May 2018

A full Disposition of Comments is available.

- Clarify that layout containment causes overflow to be treated as ink overflow only when visible (or clip)

- Layout containment suppresses baseline alignment, but size containment does not

- Layout containment causes the element to establish a new stacking context

- Size containment does not apply to tables

- Clarify that the columns and grid properties affect the size of size-contained elements

- Change the animation type of the contain property from discrete to not animatable

- Define the effect of containment on SVG elements

- Editorial improvements

- A comprehensive test suite for the full specification was developed, see http://test.csswg.org/harness/review/css-contain-1_dev

### Changes from the Candidate Recommendation of 8 August 2017

A full Disposition of Comments is available.

- Clarify to which box paint containment clips (see tests).
- Move the interaction between containment and the `bookmark-*` and `string-set` properties to [CSS-CONTENT-3] (additional tests not needed, no change in behavior).
- Remove the effects of style containment on the "break-*" properties (see tests).
- Move the description of the effects of containment on regions from this specification to [CSS-REGIONS-1] (additional tests not needed, no change in behavior).
- Clarify the effects of style scoping on counter-set and counter-increment (see tests)
- Size layout and paint containment don’t apply to internal ruby elements (see tests)
- Layout, Paint, and size containments do not apply to non-atomic inlines (see tests here and one more test here)
- Align paint containment’s behavior with overflow:clip (see test)
- Elements with size containment are monolithic (see test)
- Forced breaks area allowed in elements with layout containments, but do not propagate (see tests)
- Clarify the effects of scoping to a subtree (see test)
- Clarify the effects of scoping on open/close quotes (see tests)
- Editorial clarification: replace "Becoming a formatting context" (aka "Becoming a formatting context root") with "Establish a FC" (additional tests not needed, no change in behavior)

### Changes from the Working Draft of 19 April 2017

A Disposition of Comments covering this draft and the previous one together is available.

- Clarify the interaction with display: contents
- Clarify how containment works on table parts
- Move the interaction between containment and fragmentation of overflow from this specification to CSS-OVERFLOW-4

### Changes from the First Public Working Draft of 21 February 2017

- Specify handling of replaced elements for size containment
- Layout containment makes element act as a containing block for absolutely positioned and fixed positioned descendants.

## 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.

## Index

### Terms defined by this specification

- contain, in §2
- containing box
  - dfn for layout-containment, in §3.2
  - dfn for paint-containment, in §3.4
  - dfn for size-containment, in §3.1
- containment, in §3
- content, in §2
- layout, in §2
- layout containment, in §3.2
- none, in §2
- paint, in §2
- paint containment, in §3.4
- scoped, in §3.3
- scoped properties, in §3.3
- scoped property, in §3.3
- scoped to an element, in §3.3
- scoped to an element’s sub-tree, in §3.3
- scoped to a sub-tree, in §3.3
- scoped to the element, in §3.3
- scoped to the element’s sub-tree, in §3.3
- scoped to the sub-tree, in §3.3
- size, in §2
- size containment, in §3.1
- strict, in §2
- style, in §2
- style containment, in §3.3

https://drafts.csswg.org/css-backgrounds-3/#corner-clipping Referenced in:

- 3.4. Paint Containment

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

- 3.2. Layout Containment (2)

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

- 3.2. Layout Containment

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

- 3.2. Layout Containment (2) (3) (4) (5) (6) (7) (8)

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

- 3.2. Layout Containment (2) (3) (4) (5) (6)

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

- 3.2. Layout Containment (2) (3)

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

- 3.1. Size Containment

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

- 3.1. Size Containment
- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment (2)
- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment
- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment

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

- 3.1. Size Containment
- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment
- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment (2)
- 3.2. Layout Containment (2) (3)
- 3.4. Paint Containment (2) (3)

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

- 3.1. Size Containment

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

- 3.1. Size Containment

https://drafts.csswg.org/css-display-3/#valdef-display-table-cell Referenced in:

- 3.2. Layout Containment
- 3.4. Paint Containment

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

- 3.1. Size Containment

https://drafts.csswg.org/css-lists-3/#propdef-counter-set Referenced in:

- 3.3. Style Containment

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

- 3.1. Size Containment

https://drafts.csswg.org/css-overflow-3/#valdef-overflow-clip Referenced in:

- 3.2. Layout Containment

https://drafts.csswg.org/css-overflow-3/#ink-overflow Referenced in:

- 3.2. Layout Containment

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

- 3.2. Layout Containment
- 3.4. Paint Containment (2) (3) (4) (5)

https://drafts.csswg.org/css-overflow-3/#valdef-overflow-visible Referenced in:

- 3.2. Layout Containment

https://drafts.csswg.org/css-overflow-4/#selectordef-nth-fragment Referenced in:

- 3.2. Layout Containment

https://drafts.csswg.org/css-sizing-3/#valdef-width-auto Referenced in:

- 3.1. Size Containment

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

- 3.1. Size Containment

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

- 3.4. Paint Containment (2)

https://drafts.csswg.org/css-ui-4/#propdef-resize Referenced in:

- 3.4. Paint Containment (2)

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

- 2. Strong Containment: the contain property (2) (3)

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

- 2. Strong Containment: the contain property (2) (3)

https://www.w3.org/TR/CSS2/generate.html#value-def-close-quote Referenced in:

- 3.3. Style Containment

https://www.w3.org/TR/CSS2/generate.html#propdef-content Referenced in:

- 3.3. Style Containment (2)

https://drafts.csswg.org/css2/generate.html#propdef-counter-increment Referenced in:

- 3.3. Style Containment (2)

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

- 3.1. Size Containment

https://www.w3.org/TR/CSS2/generate.html#value-def-no-close-quote Referenced in:

- 3.3. Style Containment

https://www.w3.org/TR/CSS2/generate.html#value-def-no-open-quote Referenced in:

- 3.3. Style Containment

https://www.w3.org/TR/CSS2/generate.html#value-def-open-quote Referenced in:

- 3.3. Style Containment

https://www.w3.org/TR/CSS2/box.html#padding-edge Referenced in:

- 3.4. Paint Containment

https://drafts.csswg.org/css2/visuren.html#x43 Referenced in:

- 3.2. Layout Containment
- 3.4. Paint Containment

https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align Referenced in:

- 3.2. Layout Containment

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

- 3.1. Size Containment

https://svgwg.org/svg2-draft/struct.html#elementdef-svg Referenced in:

- 2. Strong Containment: the contain property

### Terms defined by reference

- [css-backgrounds-3] defines the following terms:
  - corner clipping
- [css-break-3] defines the following terms:
  - forced break
  - fragmentation
  - fragmentation container
  - fragmentation context
  - fragmented flow
  - monolithic
- [css-display-3] defines the following terms:
  - atomic inline
  - contents
  - display
  - establishes an independent formatting context
  - inline-level
  - inner display type
  - internal ruby box
  - internal table box
  - none
  - principal box
  - replaced element
  - table
  - table-cell
- [css-grid-1] defines the following terms:
  - grid
- [css-lists-3] defines the following terms:
  - counter-set
- [CSS-MULTICOL-1] defines the following terms:
  - columns
- [css-overflow-3] defines the following terms:
  - clip
  - ink overflow
  - overflow
  - visible
- [css-overflow-4] defines the following terms:
  - ::nth-fragment()
- [css-sizing-3] defines the following terms:
  - auto
  - sizing property
- [css-ui-3] defines the following terms:
  - text-overflow
- [css-ui-4] defines the following terms:
  - resize
- [css-values-4] defines the following terms:
  - |
  - ||
- [CSS2] defines the following terms:
  - close-quote
  - content
  - counter-increment
  - height
  - no-close-quote
  - no-open-quote
  - open-quote
  - padding edge
  - stacking context
  - vertical-align
  - width
- [SVG2] defines the following terms:
  - svg

## References

### Normative References

[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-DISPLAY-3]
  Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 11 July 2019. CR. URL: https://www.w3.org/TR/css-display-3/
[CSS-LISTS-3]
  Elika Etemad; Tab Atkins Jr.. CSS Lists Module Level 3. 17 August 2019. WD. URL: https://www.w3.org/TR/css-lists-3/
[CSS-OVERFLOW-3]
  David Baron; Elika Etemad; Florian Rivoal. CSS Overflow Module Level 3. 31 July 2018. WD. URL: https://www.w3.org/TR/css-overflow-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/
[CSS2]
  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/
[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
[SVG2]
  Amelia Bellamy-Royds; et al. Scalable Vector Graphics (SVG) 2. 4 October 2018. CR. URL: https://www.w3.org/TR/SVG2/

### Informative References

[CSS-CONTENT-3]
  Elika Etemad; Dave Cramer. CSS Generated Content Module Level 3. 2 August 2019. WD. URL: https://www.w3.org/TR/css-content-3/
[CSS-GRID-1]
  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/
[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-OVERFLOW-4]
  David Baron; Florian Rivoal. CSS Overflow Module Level 4. 13 June 2017. WD. URL: https://www.w3.org/TR/css-overflow-4/
[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-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-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/
[CSS-UI-4]
  Florian Rivoal. CSS Basic User Interface Module Level 4. 22 December 2017. WD. URL: https://www.w3.org/TR/css-ui-4/

## Property Index

Name | Value | Initial | Applies to | Inh. | %ages | Animation type | Canonical order | Computed value
--- | --- | --- | --- | --- | --- | --- | --- | ---
contain | none | strict | content | [ size || layout || style || paint ] | none | See below | no | n/a | not animatable | per grammar | specified keyword(s)

#propdef-contain Referenced in:

- 1. Introduction
- 2. Strong Containment: the contain property (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12)
- Changes from the Candidate Recommendation of 08 November 2018 (2)

#containment Referenced in:

- 2. Strong Containment: the contain property (2)
- 3. Types of Containment

#size-containment Referenced in:

- 2. Strong Containment: the contain property (2) (3)
- 3.1. Size Containment (2) (3) (4)
- 3.2. Layout Containment

#size-containment-containing-box Referenced in:

- 3.1. Size Containment (2) (3)

#layout-containment Referenced in:

- 2. Strong Containment: the contain property
- 3.1. Size Containment (2)
- 3.2. Layout Containment (2) (3) (4) (5) (6) (7) (8)

#layout-containment-containing-box Referenced in:

- 3.2. Layout Containment (2) (3) (4) (5) (6) (7) (8)

#style-containment Referenced in:

- 2. Strong Containment: the contain property (2) (3)
- 3.3. Style Containment (2) (3)
- Changes from the Candidate Recommendation of 08 November 2018

#property-scoped-to-a-sub-tree Referenced in:

- 3.3. Style Containment (2)

#paint-containment Referenced in:

- 2. Strong Containment: the contain property
- 3.4. Paint Containment (2)

#paint-containment-containing-box Referenced in:

- 3.4. Paint Containment (2) (3) (4)