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

> `:media()` has the correct semantics.

Well, not really. Pseudo-classes are query something about the element, whereas `:media()` is querying the viewport. It's a bit of a hack that it's classed to the element.

Fwiw, that's why I suggested:

```css
:root {
  @media (prefers-color-scheme: dark),
  &.dark {
    /* dark mode rules */
  }
}
```

It's saying "this block of styles applies when this media query matches, or where this selector matches". It isn't putting MQs into element classes, nor is it putting selectors into MQs.

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


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

Received on Friday, 23 September 2022 08:11:02 UTC