@container

noun

say it: “AT kun-TAY-ner” /æt kənˈteɪnər/

The CSS at-rule that writes a container query: its styles apply only when the box being measured meets a condition, such as a minimum width.

What does @container do?

@container writes a container query: styles that apply when the container meets the condition.

@container (max-width: 350px) {
  .card .details { display: none; }
}

In a sentence

  • “Inside the @container rule, the card switches to a two-column layout once its box is 30rem wide.”

Level: Freelancer · More CSS terms at this level

Updated