CSS · At-rules, values and responsive design

@container

Styles children based on the size of their container rather than the viewport.

Syntax
@container (min-width: 20rem) { … }

Example

Try it

More in this group

@font-face @import @layer @media query @supports calc() clamp() Color functions

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course