-
Notifications
You must be signed in to change notification settings - Fork 757
Description
The spec for Media Queries Level 5 currently specifies a way to define custom media properties like e.g. @custom-media --modern (color), (hover); with CSS Containment currently getting shipped beforehand, wouldn't it make sense to rename @custom-media to @custom-query, to create a reusable and unified way for creating custom properties that are including a query?
I mean if I get the idea of the current draft correctly, values inside of @custom-media could also be used inside of @container and @supports as well. But these aren't media, but feature & containment / container or even style queries.
Proposed @custom-query Solution
@custom-query --narrow-size (inline-size > 30em);
@custom-query --full-grid-support (display: grid) and (grid-template-columns: subgrid;);
@custom-query --is-special style(--is-round: true) and style(--is-highlighted: true);
@custom-query --combined-media-query-list (--narow-size), (--is-special);
@media (--narrow-window) {
...
}
@container card (--narrow-window) {
...
}
@container card (--is-special) {
...
}
@container card (--combined-media-query-list ) {
...
}
@supports (--full-grid-support) {
...
}
If from a technical stand point it isn't possible to get a unified solution for queries, this is a proposal for reusable custom-queries for supports & container, e.g. @custom-container fand @custom-supports.