Testing

Viewport Units: Browser Support, vh, dvh, svh, lvh

Viewport units (vh, vw, vmin, vmax) work in Chrome 26+, Edge 12+, Firefox 19+, Safari 6.1+, and Opera 15+. Learn unit types, use cases, and quirks.

Author

Prince Dewani

May 6, 2026

Viewport units are W3C CSS length units that size an element as a percentage of the browser viewport, including vh, vw, vmin, vmax, and the newer dvh, svh, and lvh variants. They work in Chrome 26+, Edge 12+, Firefox 19+, Safari 6.1+ on macOS and iOS, Opera 15+, and Samsung Internet 4+, with partial support in Internet Explorer 9 to 11.

This guide covers what viewport units are, the browsers that support them, the unit types, common use cases, and known issues.

What is Viewport Units?

Viewport units are CSS length units defined in the W3C CSS Values and Units Module that size an element relative to the browser viewport. The base set is vh, vw, vmin, and vmax. Each one equals 1% of the viewport height, width, smaller side, or larger side.

Which browsers does Viewport Units support?

Viewport units work in every modern desktop and mobile browser. The classic vh, vw, vmin, and vmax shipped early across Chrome, Firefox, and Safari, while the dynamic svh, lvh, and dvh variants arrived more recently in Chrome 108+, Firefox 101+, and Safari 15.4+.

Loading browser compatibility data...

Viewport units compatibility in Chrome

Chrome supports vh, vw, vmin, and vmax from Chrome 26 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 20 to 25 had partial support, and Chrome 4 to 19 did not support them. Chrome 108 added the dynamic units dvh, svh, lvh, and their width and logical-side counterparts.

Viewport units compatibility in Edge

Microsoft Edge supports the classic units from Edge 12 on Windows, macOS, Linux, Android, and iOS, with full vmax from Edge 16 on the EdgeHTML engine. Chromium Edge from Edge 79 onwards behaves the same as Chrome and added dvh, svh, and lvh from Edge 108.

Viewport units compatibility in Firefox

Firefox supports vh, vw, vmin, and vmax from Firefox 19 on Windows, macOS, Linux, and Android. Firefox 1 to 18 did not support them. Firefox 101 added the dynamic units dvh, svh, lvh, and the matching width and logical-side variants.

Viewport units compatibility in Safari

Safari supports vh and vw from Safari 6.1 on macOS and Safari 8 on iOS. Safari 6 had partial support, and Safari 6 and 7 ignore viewport units inside calc(). vmax shipped in Safari 6.1 on macOS and Safari 8 on iOS. Safari 15.4 on macOS and iOS added dvh, svh, and lvh.

Viewport units compatibility in Opera

Opera supports vh, vw, vmin, and vmax from Opera 15 on desktop and from Opera Mobile 14 on Android. Opera 9 to 12.1 used the Presto engine and did not support viewport units. Opera 94 added the dynamic dvh, svh, and lvh units. Opera Mini, the proxy-rendered browser, still does not support any viewport unit.

Viewport units compatibility in Samsung Internet

Samsung Internet supports vh, vw, vmin, and vmax from Samsung Internet 4 on Galaxy phones and tablets. The browser is built on Chromium, so it follows the same rules as Chrome for Android. Samsung Internet 21 added dvh, svh, and lvh.

Viewport units compatibility in Android Browser

Chrome for Android supports the classic units from Chrome 25 on Android 4.0 and later. The legacy stock Android Browser added support in Android 4.4 KitKat WebView. Android 2.1 to 4.3 did not support viewport units at all. Use Chrome for Android, Firefox for Android, or Samsung Internet for full coverage.

Viewport units compatibility in Internet Explorer

Internet Explorer 9, 10, and 11 ship partial support for vh and vw, but vmax does not work at all and the units fail inside the font shorthand. IE 6 to 8 do not support viewport units. None of the dynamic units (dvh, svh, lvh) work in any IE version. Microsoft has retired Internet Explorer, so use Edge for any new work.

Note

Note: Viewport units behave differently in IE 9 to 11, Safari 6 to 7, and mobile Safari before 15.4. Test them on real browsers and OS with TestMu AI. Try TestMu AI free!

What are the types of viewport units?

CSS Values and Units Level 4 defines four families of viewport units. Each family has a height, width, smaller-side, and larger-side variant, plus inline and block logical-side variants. The four families differ in which viewport size they measure against on mobile.

  • Default units (vh, vw, vmin, vmax): 1vh is 1% of the viewport height, 1vw is 1% of the width, vmin uses the smaller side, and vmax uses the larger side. On mobile, the spec aligns these with the large viewport, so 100vh equals the screen with the address bar collapsed.
  • Small viewport units (svh, svw, svmin, svmax): Measure against the smallest viewport, where the mobile address bar and toolbars are fully visible. 100svh never overflows the visible area. Ship in Chrome 108+, Firefox 101+, and Safari 15.4+.
  • Large viewport units (lvh, lvw, lvmin, lvmax): Measure against the largest viewport, where mobile UI is collapsed. 100lvh equals 100vh on every modern browser. Useful when you want a deliberate overflow under the address bar.
  • Dynamic viewport units (dvh, dvw, dvmin, dvmax): Track the visible viewport in real time as the address bar shows or hides on mobile. 100dvh resizes when the user scrolls and the toolbar collapses, so a full-screen layout stays edge to edge.
  • Logical variants (vi, vb, svi, svb, lvi, lvb, dvi, dvb): Match the writing-mode inline and block axes instead of physical width and height. Useful for vertical scripts and right-to-left layouts.
/* Classic viewport units, supported almost everywhere */
.hero {
  height: 100vh;
  font-size: calc(1rem + 1vw);
}

/* Modern dynamic units, Chrome 108+, Firefox 101+, Safari 15.4+ */
.full-screen {
  height: 100vh; /* fallback for older browsers */
  height: 100dvh; /* tracks the visible viewport on mobile */
}

/* Smallest viewport, address bar shown */
.app-shell {
  min-height: 100svh;
}

What are the use cases of viewport units?

Viewport units show up across almost every production web app where layout has to follow the screen instead of the parent. The most common patterns lock content to the viewport, scale type fluidly, and replace JavaScript-driven resize logic.

  • Full-screen heroes: height: 100vh sizes a hero section to the full viewport. On mobile, swap to 100dvh so the hero tracks the address bar instead of overflowing under it. Notion, Stripe, and Linear all use this pattern.
  • Fluid typography: font-size: clamp(1rem, 1rem + 1vw, 2rem) scales body text smoothly between mobile and desktop without a single media query. Pair vw with rem so the floor stays accessible at zoom levels.
  • Aspect-locked media: width: 100vw on a video keeps it edge to edge regardless of the parent container, useful for above-the-fold backgrounds and immersive sections.
  • Sticky app shells: A flex column with min-height: 100svh on the wrapper and overflow: auto on the inner scroll area gives a mobile app shell that does not jump when the toolbar appears.
  • Modal overlays: position: fixed; inset: 0; height: 100dvh keeps a modal pinned to the visible viewport on iOS Safari, where 100vh would leave the bottom of the modal hidden under the address bar.
  • Container-aware spacing: padding: 2vmin works on portrait and landscape phones because vmin tracks the shorter side. The padding stays balanced when the user rotates the device.
...

What are the known issues with viewport units?

Viewport units are widely supported, but a handful of edge cases still bite in production. Most surprises come from mobile Safari, scrollbar measurement on desktop, and the IE 11 partial-support quirks.

  • iOS Safari overflows under the address bar: 100vh equals the large viewport, so a 100vh hero hides its bottom slice behind the toolbar until the user scrolls. Use 100dvh on Safari 15.4+ or 100svh for a guaranteed visible-area fit.
  • Desktop browsers include the scrollbar in 100vw: Chrome, Firefox, and Edge size 100vw to the layout viewport, which includes the vertical scrollbar gutter. An element at 100vw triggers a horizontal scrollbar on pages with overflowing content. Use width: 100% on the body or 100dvw on Chrome 108+ and Firefox 101+.
  • IE 11 fails inside font shorthand: font: 16px/1 sans-serif works, but font: 4vw/1 sans-serif silently breaks on IE 9 to 11. Set font-size separately and the longhand parses correctly.
  • Safari 6 and 7 ignore viewport units inside calc(): calc(100vh - 80px) returns the static fallback on those Safari versions, so the layout collapses on iOS 6 and iOS 7. iOS 8 and later treat them the same as Chrome.
  • Android keyboards resize 100dvh: When the soft keyboard opens, dvh shrinks to the area above the keyboard. A 100dvh modal jumps when an input gets focus. Lock the modal height with 100svh or attach a visualViewport listener if you need the keyboard-resize behavior.
  • Print stylesheets ignore the viewport: Browsers compute viewport units against the page box during print, not the screen, so a 100vh hero prints as one full page. Override with explicit cm or in values inside an @media print block.
  • iframes use the iframe viewport: 100vh inside an iframe equals the iframe height, not the parent page. Cross-document layouts that rely on parent dimensions need postMessage or visualViewport instead.

In my experience, the bug that costs the most debugging time is the iOS Safari 100vh overflow. The hero looks correct in DevTools, the user opens the page on an iPhone, and the call-to-action sits hidden under the address bar. Switching to 100dvh on Safari 15.4+ fixes it in a single line.

...

Citations

All viewport unit version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests