Skip to content

Journal Design

Responsive Design in 2026: Container Queries & Fluid Typography

Media queries alone are no longer enough. How do we build interfaces that adapt flawlessly to any screen using Container Queries, clamp(), and modern CSS?

Published
Reading time
5 minutes
By
Webify

When Ethan Marcotte coined the term "responsive design" in 2010, our only tool was @media queries. Today, CSS is equipped with powerful tools that enable component-based responsive design. With Container Queries, Fluid Typography, and Subgrid, we now design based on the space a component occupies, not the screen size.

Container Queries: Component-Level Responsive

Traditional media queries respond to viewport width. But the same component can be placed in areas of different widths on different pages. With Container Queries, a component changes its style based on its parent container's dimensions.

/* Container Query Usage */
.card-wrapper {
  container-type: inline-size;
  container-name: card;
}

@container card (min-width: 400px) {
  .card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
  }
}

@container card (max-width: 399px) {
  .card {
    display: flex;
    flex-direction: column;
  }
}

This approach is revolutionary for design systems and component libraries. A card component can automatically switch to a vertical layout when placed in a sidebar, and a horizontal layout when placed in the main content area.

Fluid Typography: No More Breakpoints

Instead of abrupt size changes at breakpoints, the CSS clamp() function allows font sizes to scale continuously and fluidly based on viewport width.

/* Fluid Typography */
h1 {
  /* Minimum 2rem, maximum 4.5rem,
     fluid transition based on viewport width */
  font-size: clamp(2rem, 5vw + 0.5rem, 4.5rem);
  line-height: 1.1;
}

p {
  font-size: clamp(0.875rem, 1.5vw + 0.25rem, 1.125rem);
  line-height: 1.7;
}
"The secret of a premium interface is that the user never feels a 'break' when resizing the screen — everything should be fluid."

CSS Subgrid: Grid Within a Grid

Subgrid allows nested grid components to align with the parent grid's row and column tracks. This is critically important for achieving pixel-perfect alignment of titles, descriptions, and button heights in card lists.

Conclusion

Modern CSS has freed responsive design from viewport dependency. With Container Queries we think component-first, with Fluid Typography we eliminate breakpoints, and with Subgrid we achieve pixel-perfect alignment. At Webify, we embrace these modern approaches in all our projects.