CSS 3 · Responsive design

Respond to the container's size

Style a component according to the space it has, not the screen.

.card-wrapper {
  container-type: inline-size;
}

@container (min-width: 400px) {
  .card { display: flex; }
}

Official CSS 3 documentation

More responsive design commands

All responsive design commands · CSS 3 cheatsheet

Was this page helpful?