Skip to content

[css-contain-3] Reference named containers for cq units #7858

@una

Description

@una

In the [contain-level-3] spec it is possible to name containers, referencing them in @container. It is also possible to use container query units. However, it seems like there is a gap (I might be missing it in the spec) for how to reference a named container when using cq units.

An author might want to specify the container they are referencing when using the cq units (rather than defaulting to the nearest container). Using container-name wouldn't work, since it would set the name. Would it be possible to add a "container-reference"-type-property (name TBD) that can be accessed within an CSS declaration?

I.e. for illustration:

.meta p {
  container-reference: card;
  font-size: clamp(1rem, 10cqi, 2rem);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions