November 5, 2026 by Henrik Karlström
CSS viewport units: svh, lvh, dvh and when to use each
Why 100vh overflows on phones, what the small, large and dynamic viewport units do, which one to pick for a hero, a full-screen layout or a chat view, and browser support in 2026.
Rewritten in November 2026. The original post from April 2024 announced support for these units in Flipsite; this version is the guide we wished we had then.
In short: 100vh on a phone is the height of the screen with the browser's address
bar hidden, so a full-height section overflows by the height of that bar while the bar is showing. The fix is three
units that came with CSS Values 4: svh is the viewport with the bars showing, lvh with the bars hidden, and dvh whatever it is right
now. Use 100svh for a hero that must fit on first load, 100lvh for a background that may extend under the bars, and 100dvh only
when the layout has to follow the bars as they move. All current browsers support them.
The problem with 100vh on mobile
Mobile browsers hide the address bar when you scroll down and show it again when you scroll up, and the keyboard takes a
third of the screen when a field has focus. The old vh unit ignores all of that:
1vh is one percent of the largest possible viewport, with every bar hidden. So a
section set to height: 100vh is taller than what the visitor sees on first load, the
bottom of it sits under the address bar, and a button placed there is out of reach until the visitor scrolls.
For years the workarounds were JavaScript that measured window.innerHeight and wrote
a custom property, or min-height: -webkit-fill-available for Safari only. Both break
in some browser, and both add work to every page load.
The three viewports
The CSS Values and Units Module Level 4 defines three viewport sizes for the same screen:
-
Small viewport: the space left when every browser bar is showing. Units:
svw,svh,svmin,svmax,svi,svb. -
Large viewport: the space when every bar is hidden. Units:
lvw,lvh,lvmin,lvmax,lvi,lvb.vhandvware the same aslvhandlvw. -
Dynamic viewport: the space right now, which changes as the bars appear and disappear. Units:
dvw,dvh,dvmin,dvmax,dvi,dvb.
The i and b variants follow the writing
direction: inline is the width in a left-to-right language and block the height, and the other way round in a vertical
script. The min and max variants take the
smaller or larger of the two dimensions, like vmin and vmax.
Which unit to use
| You want | Use | Why |
|---|---|---|
| A hero that fits the screen on first load, with the button visible | min-height: 100svh |
The small viewport is what the visitor sees before scrolling. Nothing hides under the address bar. |
| A background or image that may run under the bars | height: 100lvh |
The large viewport is the biggest the screen gets. A background that is slightly taller than the screen hurts nothing. |
| A chat view, a map or an app-like layout that must track the bars and the keyboard | height: 100dvh |
The dynamic viewport follows the bars. The page reflows while they animate, so use it only where that is wanted. |
| A sticky footer bar | bottom: 0 with position: fixed |
No viewport unit needed. Fixed elements already follow the visible area. |
A rule of thumb: svh for anything the visitor must see, lvh for decoration, dvh for app screens. Avoid dvh on text content, because the text jumps every time the address bar moves.
Example
.hero {
min-height: 100vh; /* fallback for browsers from before 2022 */
min-height: 100svh; /* fits the first screen on phones */
}
.chat {
height: 100dvh; /* follows the address bar and the keyboard */
}
.backdrop {
height: 100lvh; /* may run under the bars, that is fine */
}
Write the vh line first and the svh line after
it. A browser that does not know svh ignores that line and keeps vh, one that knows it takes the later one.
Browser support in 2026
The small, large and dynamic units shipped in Safari 15.4 in March 2022, Firefox 101 in May 2022 and Chrome and Edge 108
in November 2022. Every browser version in use today supports them, so the vh
fallback above is only for the few visitors on browsers that have not been updated in four years.
How Flipsite handles it
In Flipsite you pick the unit in the size field of any component, so a hero gets 100svh without writing CSS, and the canvas shows the page at each of the six screen sizes, so you see the
result on a phone before you publish. Start for free, or read how Flipsite gets to 100 on Lighthouse.
Further reading
Schema.org in 2026: what still earns rich results, and what AI assistants read
November 14, 2026 by Fredrik Rönnlund • 4m
Where to host your static website: a practical guide
October 17, 2025 by Fredrik Rönnlund • 5m
How to ace the Google Lighthouse speed test
February 13, 2025 by Henrik Karlström • 3m
The case for static websites over dynamic ones
October 5, 2024 by Henrik Karlström • 3m