Container name

noun

say it: “kun-TAY-ner NAYM” /kənˈteɪnər neɪm/

A CSS property that gives a measured box a name, so a container query can say exactly which box it means instead of using the nearest one.

What does container-name do?

container-name names a query container so a query can target that one specifically.

.sidebar { container: sidebar / inline-size; }
@container sidebar (min-width: 300px) { .widget { padding: 24px; } }

In a sentence

  • “I set the container name to bike-spot, so the card's query checks that box and not the one inside it.”

Level: Freelancer · More CSS terms at this level

Updated