Container Queries
Container queries style elements based on the size of their parent container, not the viewport — perfect for reusable components.
Container queries style elements based on the size of their parent container, not the viewport — perfect for reusable components.
.card-wrapper { container-type: inline-size; }
.card { display: block; }
@container (min-width: 400px) {
.card { display: flex; align-items: center; gap: 1rem; }
}
Container queries unlock truly context-aware components independent of page layout.