Viewport units

Viewport units (vw, vh, vmin, vmax) size elements relative to the screen, so 1vw equals 1% of the viewport width, making layouts and type scale fluidly.
Design
Created on
23.08.2026

Summarize this

Viewport units size elements relative to the browser viewport rather than a parent or the root font. 1vw equals 1% of the viewport width and 1vh equals 1% of its height, so an element sized in viewport units scales fluidly as the screen changes. They power full-height sections, fluid typography and layouts that adapt without a breakpoint.

The main units

UnitRelative toExample
vw1% of viewport widthwidth: 50vw
vh1% of viewport heightheight: 100vh
vmin1% of the smaller sidefont-size: 5vmin
vmax1% of the larger sidepadding: 2vmax
dvh1% of the dynamic viewport heightheight: 100dvh

The mobile viewport problem

On phones, the address bar shows and hides as you scroll, so the classic 100vh can be taller than the visible area and cause a jump. Newer units fix this: svh (small), lvh (large) and dvh (dynamic) track the real viewport, and 100dvh is now the safe way to make a section fill the mobile screen.

Common uses

  • Full-height hero sections with min-height: 100dvh.
  • Fluid typography, usually inside clamp() so it never gets too small or too large.
  • Spacing and imagery that scale with the screen.

Viewport units versus percentages and rem

A percentage is relative to the parent element, rem is relative to the root font size, and a viewport unit is relative to the screen. Use percentages for layout inside a container, rem for accessible type and spacing, and viewport units when something should scale with the whole screen.

Pitfalls and best practices

100vw can be slightly wider than the visible area when a scrollbar is present, causing horizontal overflow, so prefer 100% for full-width blocks. Avoid sizing body text in pure vw because it can break zoom and accessibility; wrap it in clamp() with a rem floor instead.

Viewport units at BeBranded

At BeBranded we use viewport units for fluid heroes and type that scale cleanly across screens, always guarded for mobile and accessibility. It is part of the responsive craft in our design work.

FAQ

Viewport units size elements relative to the browser viewport. 1vw is 1% of its width and 1vh is 1% of its height, so elements scale fluidly with the screen.
A percentage is relative to the parent element, while vw is relative to the whole viewport width. So 50% depends on the container, but 50vw is always half the screen width.
100dvh is 100% of the dynamic viewport height, which tracks the real visible area on mobile as the address bar shows and hides. It fixes the classic 100vh jump on phones.
vmin is 1% of the smaller viewport side and vmax is 1% of the larger side. They are handy for elements that should scale with whichever dimension is limiting.
Not on its own, because pure vw text can break zoom and accessibility. Wrap it in clamp() with a rem minimum so it stays readable and still scales with the screen.
Yes. You can set sizes in vw and vh in the Designer, and add newer units like dvh through custom properties or custom code.

Ready to boost your conversions?

Our team is here to understand your needs & work with you to create your next projects.
Get news, infos and resources.
Actionable tips delivered straight to your inbox.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.