Reblogged by slightlyoff@toot.cafe ("Alex Russell"):
chriscoyier@front-end.social ("Chris Coyier") wrote:
The CSS feature `@container style()` is pretty neat!
Are you familiar with `@mixin` in Sass? It's a little bit like that.
- Declare a chunk of CSS you want to re-use
- Set a --custom-property to trigger it
Attachments:
- SCSS code featuring a @mixin and then calling that mixin with an @include call. (remote)
- CSS code setting up a @container (style) query watching for --featured: true; and then "calling" it by setting that custom property on two different selectors. (remote)
- Examples of elements being styled with our custom chunk of code, making the background yellow and putting a star in the upper right area. (remote)