Menu

Post image 1
Post image 2
1 / 2
0

Beyond Viewport Units: svh, lvh, and dvh Explained

DEV Community·Nick Benksim·about 1 month ago
#1gOHNPmt
Reading 0:00
15s threshold

Beyond Viewport Units: svh, lvh, and dvh Explained For years, frontend developers have relied on the classic viewport units— vw, vh, vmin, and vmax —to create responsive layouts. While these units have served us well, they have always suffered from a frustrating inconsistency: the mobile browser address bar. When the address bar expands or retracts, the height of the viewport changes, causing layout shifts, jumps, and broken designs. Enter the new dynamic viewport units: svh, lvh, and dvh . The Problem with the Traditional ‘vh’ Unit In most modern mobile browsers, the 100vh unit is calculated based on the maximum possible height of the viewport, effectively ignoring the browser’s dynamic UI elements like the top address bar or the bottom navigation bar. Consequently, when a user scrolls, the bottom of your “full-height” container is often hidden behind the browser interface. This has forced developers to rely on complex JavaScript hacks or CSS workarounds to achieve a true “full-screen” experience.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More