Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. CSS
  3. Guides
  4. Containment

CSS containment

TheCSS containment module defines containment and container queries.

Containment enables the isolation of page subtrees from the rest of the DOM. The browser can then improve performance by optimizing the rendering of these independent parts.

Container queries are similar to dimensionmedia queries, except that the queries are based on the dimensions of a specific container element defined as acontainment context, rather than on the dimensions of the viewport. Container queries enable querying a container's size, properties, and property values to conditionally apply CSS styles. When applying these conditional styles, you can use container query length units, which specify lengths relative to the dimensions of the query container. Additional properties are defined to enable establishing a specific element as a query container and giving it a specific name.

Reference

Properties

Events

Interfaces

Guides

CSS container queries

A guide to using container queries with@container, including naming containment contexts.

Using CSS containment

Describes the basic aims of CSS containment and how to leveragecontain andcontent-visibility for a better user experience.

Using container size and style queries

A guide to writing container size and style queries with@container, including style queries for custom properties, query syntax and names, and nesting container queries.

Related concepts

Specifications

Specification
CSS Containment Module Level 2
CSS Containment Module Level 3

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp