Why 100vh Doesn’t Always Fit a Mobile Screen
height: 100vh sounds like “fill the visible screen.” On a phone, browser controls appear and disappear, so there is more than one useful definition of the viewport height.
That mismatch can put a button below the visible area or make a full-screen panel jump while someone scrolls.
Mobile has several viewport heights
The traditional unit is one percent of the viewport height:
.hero { min-height: 100vh; }
Modern CSS adds three more explicit choices, documented in MDN’s length reference:
svhuses the small viewport, with browser controls visible;lvhuses the large viewport, with controls retracted;dvhfollows the dynamic viewport as controls change.
For a hero that must fit without hiding its bottom edge, I usually start with:
.hero { min-height: 100svh; }
For an app-like panel that should track the currently visible area:
.panel { height: 100dvh; }
Dynamic sizing can move during scrolling, so it is not automatically the calmest choice.
Prefer flexibility when exact height is unnecessary
min-height lets content grow:
.hero {
min-height: 100svh;
display: grid;
place-items: center;
}
That is safer than forcing long text into exactly one screen. Full-height design should not make content overflow merely to preserve a mockup.
A fallback can come first:
.hero {
min-height: 100vh;
min-height: 100svh;
}
Browsers that understand svh use it; older ones keep vh. Width equivalents—svw, lvw, and dvw—exist too, though the mobile toolbar problem is usually about height.
100vh is not broken. It is simply one viewport definition. Choose the unit from the behaviour the component needs, and avoid an exact full-screen height when ordinary document flow would work better.
Enjoyed reading this?
If you found this article helpful, consider supporting my writing. Every little bit helps keep this blog going.
Related articles
- Making Links Easy to Recognize
Make links recognisable with underlines, clear focus states, useful text, and behaviour that does not surprise the reader.
- Smoother Page Changes With View Transitions
Use the View Transition API for same-page state changes and progressive cross-document animation on a normal multi-page site.
- When to use CSS clip-path or mask
Choose between CSS clip-path and mask by deciding whether the element needs a hard boundary or levels of transparency.