Back to all articles

Stop Using 100vh for Full-Height Layouts on Mobile: Here’s Why

Alvin Pratama1 min read
CSSMobileResponsive DesignWeb Development
Stop Using 100vh for Full-Height Layouts on Mobile: Here’s Why

If you're using 100vh for full-height layouts in your CSS, you might be unknowingly creating layout issues — especially on mobile devices.

🚫 The Problem: `100vh` measures the viewport height *without accounting for dynamic browser UI elements*, such as the mobile address or navigation bars. This means your layout may look fine on desktop but: - Content gets cut off on mobile - Unwanted scrollbars appear - Elements don't align correctly

✅ The Modern Fix: `100dvh` Instead of hardcoding `height: 100vh;`, use:

css
height: 100dvh;

The new dvh unit (Dynamic Viewport Height) adapts to visible screen size, **even when browser UI changes** — like when the address bar hides on scroll.

🧠 TL;DR - **Before:** `height: 100vh;` → breaks layouts on mobile - **Now:** `height: 100dvh;` → mobile-safe and reliable

It’s a tiny change with a big impact that saves hours of layout debugging.