Post

```#css .container { container-name: --example; } h1 { color: red; @container --example { color: green; } } ``` Canary and Tech Preview both showing green text! Gettin there, excited for these to hit stable.

4 reposts48 likes

We’ve got a 3 day hack fest coming up soon; I was thinking I could use that time to try and contribute to FF for the first time. Maybe.

Pardon the question: Wouldn't a ".container h1" selector (after the standard h1 selector) accomplish the same thing? I admit, I'm not aware of the latest stuff, so there's probably a modern angle I'm missing 😅

I think the idea is to use container queries with more specificity, this example just doesn't reflect that. Example from MDN: ``` @container sidebar (width > 700px) { .card { font-size: 2em; } } ```

I kinda see where this is going. My old-ways mind immedately jumps to "Why not just put '.container sidebar .card' in the appropiate >700 media query?" but I guess this will allow for surgical changes without being too global 😊 I'll check MDN!

The key thing here is that the query relates to the container, not the window. AFAIK there's no way to check if element is of a certain size in pure CSS without @container.