Skip to content

[css-extensions] Custom container queries #8121

@romainmenke

Description

@romainmenke

This was requested in csstools/postcss-plugins#671

It would be in parallel with @custom-media.

@custom-container <extension-name> <container-condition>
@custom-container --foo card (inline-size > 30em) and style(--responsive: true)

@container (--foo) {
  /* styles */
}

I personally do think the benefits of having this are smaller than they are with @custom-media.
The same media conditions are often re-used throughout an entire code base.
Assigning these to a named variable has obvious code quality benefits.

Container queries however are much more local.
They are more often tied to the code contained therein.
I can be wrong about this, this is purely my impression.

Maybe @mirisuzanne proposal to allow var() inside <container-condition> is all authors need?

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