Re: [csswg-drafts] [css-conditional] [css-contain] Fleshing out @container queries with single-axis containment (#5796)

A thought about scoped container queries (I hope I didn't miss something written about this before)

The first thing I thought about when reading the scoped container section was the `@keyframes` syntax - why not name queries so they are reusable instead of limiting ourselves to specific selectors? 
Media queries has one scope - the media, but container queries should have the option to relate to more than one scope:

Something like -
```css
@container someNamedQuery (width > 45em) {
  ...
}

@container otherNamedQuery (width > 80em) {
  ...
}

/* All sections can have one rule (don't mind my naming, I'm bad at it) */
section {
  contain: layout size;
  container-query: someNamedQuery;
}

/* But we override this rule for sections that should behave differently */
section.special-rules {
  contain: layout size;
  container-query: otherNamedQuery;
}
```



-- 
GitHub Notification of comment by tombigel
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5796#issuecomment-779142789 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 15 February 2021 10:59:56 UTC