4.4 · Responsive components

Readable breakpoints and real viewport height

Write breakpoints as comparisons, and size to the viewport that’s actually visible.

Media queries accept comparisons now: @media (width >= 45rem) and even (30rem <= width < 45rem). No more min-width: 45rem paired with max-width: 44.99rem to avoid overlaps.

On phones, 100vh is taller than the screen when the browser bars are visible. svh is the small viewport (bars shown), lvh the large one (bars hidden), and dvh follows whichever is current.

Before
@media (min-width: 30rem) and
       (max-width: 44.99rem) { … }

.hero { height: 100vh; } /* too tall on phones */
Now
@media (30rem <= width < 45rem) { … }

.hero { block-size: 100dvh; }