[css-contain-3] Multiple <container-query>s with multiple containers

Open
#6,876 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
css
Domain
web-dev

Research direction

Start by reading the linked CSS Containment Level 3 specification, especially the container-condition and query-container sections, then compare them with the proposed syntax in the issue. Determine whether multiple conditions can target different containers and document the outcome in the specification or discussion; completion requires a resolved CSSWG direction.

Written by the indexing model from the issue text.

Description

Closed Deferred css-conditional-6

The spec currently reads (emphasis mine):

Once an eligible query container has been selected for an element, each container feature in the <container-condition> is evaluated against that query container.

Applied to the example below, both conditions will be evaluated against wrapper

.wrapper {
  container-name: wrapper;
}

.wrapper > .child {
  container-name: child;
  --responsive: true;
}

@container wrapper size(inline-size > 30em) and style(--responsive = true) {
  .wrapper > .child {
    /* styles */
  }
}

What I want to have size(inline-size > 30em) be evaluated against wrapper and style(--responsive = true) against child (or any other wrapping container) ?

Would it be feasible to pursue something like the snippet below, where it's allowed to set a <container-name> for each <container-query>?

/* Evaluate size() against wrapper, and evaluate style() against child */
@container wrapper size(inline-size > 30em) and child style(--responsive = true) {
  .child {
    /* styles */
  }
}
Dominant language
Bikeshed
Stars
4.9k
Forks
816
Avg merge
2d 18h
Merged PRs (30d)
24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from w3c/csswg-drafts

All issues in w3c/csswg-drafts

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.