concept

CSS Viewport Units

CSS viewport units are relative length units in CSS that are based on the dimensions of the browser's viewport (the visible area of a web page). They include vw (viewport width), vh (viewport height), vmin (viewport minimum), and vmax (viewport maximum), allowing developers to size elements proportionally to the screen size. This enables responsive design by creating layouts that adapt fluidly to different devices and screen resolutions.

Also known as: Viewport Units, vw/vh units, CSS vw vh, Viewport relative units, CSS viewport sizing
🧊Why learn CSS Viewport Units?

Developers should learn and use CSS viewport units when building responsive web designs that need to scale elements based on screen dimensions, such as for full-screen hero sections, fluid typography, or grid layouts that maintain proportions across devices. They are particularly useful for mobile-first development, ensuring consistent user experiences without relying heavily on media queries, and for creating dynamic interfaces like modals or overlays that adjust to viewport changes.

Compare CSS Viewport Units

Learning Resources

Related Tools

Alternatives to CSS Viewport Units