1
HTML/CSSIntermediate#css#performance
Media queries respond to the viewport size, while container queries (@container) respond to the size of a specific parent container, allowing a component to adapt its styles based on the space it's actually given, regardless of overall screen size — essential for reusable component libraries.
.card-container { container-type: inline-size; container-name: card; }
@container card (min-width: 400px) {
.card { flex-direction: row; }
}