Re: [csswg-drafts] [selectors][mediaqueries] :media() pseudo-class as a shortcut for one-off media queries (#6247)

@brandonmcconnell 
> Would this pseudo-class counterpart to the @media at-rule work directly on selectors or only inside :is() and :not()?

Anywhere. No reason for it not to.

> It might help to organize a comprehensive list of all at-rules that could benefit from a pseudo-class counterpart like this.

Yes, I think putting a little more thought into this problem holistically is needed. Just dropping a `:media()` pseudo would be *useful*, but it kicks the can down the road, and we already have a lot of examples that would similarly benefit, as you've listed.

@trusktr 
> If this comes out, please make sure it intuitively works with the color-scheme: property.

This wouldn't, it's specifically about the media query, and will work exactly as the media query does. For making things respond to `color-scheme` locally, we have `light-dark()` for colors, and are discussing widening it to work on images, and having an `if(color-scheme(): ...;)` test for arbitrary values.

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


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

Received on Monday, 4 August 2025 20:44:34 UTC