Container query
noun
say it: “kun-TAY-ner KWEER-ee” /kənˈteɪnər ˈkwɪri/
A CSS rule that styles an element based on the size of the box it sits in, instead of the size of the whole screen.
What is a container query?
A container query styles an element based on the size of its container rather than the whole screen, so a card can adapt wherever it is placed.
.card-list { container-type: inline-size; }
@container (min-width: 400px) {
.card { display: flex; }
}
In a sentence
- “Thanks to a container query, the bike card shows its photo beside the price in the wide column and above it in the sidebar.”
Level: Freelancer · More CSS terms at this level
Updated