Dynamic Viewport Units (dvh, svh, lvh)
On mobile browsers, 100vh equals the largest possible viewport (with the address bar hidden), pushing bottom buttons off-screen on load. svh locks to the small viewport (toolbars visible), lvh to the large viewport, and dvh resizes dynamically as toolbars collapse.
100vh Mobile Clipping vs 100svh / 100dvh
Compare how mobile browser chrome interacts with vh, svh, and dvh.
.hero-screen {
height: 100vh;
display: grid;
align-content: space-between;
}Bottom CTA hides under mobile URL bar on initial load.
.hero-screen {
min-height: 100svh; /* Safe & static */
min-height: 100dvh; /* Dynamic if desired */
display: grid;
align-content: space-between;
}Fits cleanly above the mobile URL bar on first paint.
Under the Hood
Mobile browsers have a telescoping frame: the address bar and bottom tab bar slide in and out during scroll, changing the visible height without changing device dimensions.
svh(Small): Assumes all browser toolbars are expanded. Zero layout shifts during scroll.lvh(Large): Assumes all toolbars are retracted, identical to legacyvh.dvh(Dynamic): Tracks the live toolbar state during Render Tree & Layout, resizing the element whenever toolbars animate.
.app-viewport {
/* Fallback for ancient engines, then Small Viewport */
min-height: 100vh;
min-height: 100svh;
}Pair min-height: 100dvh with CSS Scroll Snap or fixed app shells carefully to avoid mid-scroll jumps.
Problem Genealogy
- 2015–2021: Developers hacked
window.innerHeight * 0.01into a--vhCSS variable onresize, causing initial load flashes. - 2022+: CSS Values Level 4 introduced
sv*,lv*, anddv*units across all major browsers.
Production Pitfalls
- Using
100dvheverywhere: Applyingheight: 100dvhto long-scrolling landing page sections triggers Layout reflows while the user's thumb drags the page. heightinstead ofmin-height: Hardcodingheight: 100svhclips overflowing content on landscape phones; always prefermin-height.
- When not to use
dvh: Avoiddvhon scrollable marketing sections or elements holding heavy text; usesvhso line wraps never jump mid-scroll.
Connections & Logical Next Steps
Viewport units resolve during Layout against the small, large, or dynamic viewport box.
Dynamic viewport units resize container bounds on toolbar transitions, whereas CSS Scroll Snap locks scrollport alignment.