What is the @content directive used for?

Technology CommunityCategory: CSSWhat is the @content directive used for?
VietMX Staff asked 3 years ago

@content allows for Mixin extension. We can pass a block to Mixins with the use of @content.

Consider mixin:

@mixin small() {
    @media only screen and (max-width: 320px) {
        @content;
    }
}```
Instead of having to type the media query everytime, this feels like a much more stable way to handle media queries:
```css
@include small {
    // css code for small screens go here
}