Viewport-relative Units
suggest change1vmin is one percent of the viewport's smaller dimension; 1vmax is one percent of its larger dimension.
.hero__title {
font-size: clamp(2rem, 6vmin, 5rem);
}
Modern CSS also distinguishes viewport sizes affected by mobile browser interfaces:
| Unit family | Meaning |
|---|---|
svw, svh |
Small viewport size |
lvw, lvh |
Large viewport size |
dvw, dvh |
Dynamic viewport size |
Use 100dvh when a region should follow the currently visible viewport as browser controls expand or collapse. Use 100svh when content must fit without being obscured even in the smallest viewport state.
For readable text, combine viewport units with a user-scalable unit such as rem and set bounds with clamp().
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents