Viewport width unit
The CSS vw unit is a viewport-relative length equal to one percent of the viewport width.
Math for Web Design
The vw unit is a CSS viewport unit equal to one hundredth of the viewport's width.
- How it is used
- Sizes layouts and typography against viewport width rather than a parent’s width.
- How deep it goes
- Defines viewport-to-pixel conversion and derives a linear `vw` factor for bounded font scaling.
- Examples
- Calculates a `10vw` heading at 1,200px and bounds fluid font size with `clamp(1rem, 0.5rem + 2vw, 2rem)`.
- What you can do after
- Apply it via CSS to size elements against viewport width and keep fluid headings within chosen limits.
CSS in Depth, Second Edition
The CSS vw unit represents one percent of the viewport width.
- How it is used
- Uses viewport-relative lengths to size elements against the visible browser frame and to scale typography with viewport width.
- How deep it goes
- Defines vw mathematically, works through sizing and typography examples, and addresses scrollbar and mobile-viewport caveats without detailing browser internals.
- Examples
- Shows a 90vmin square across screen orientations and font sizes that respond continuously to viewport width.
- What you can do after
- Evaluate/understand when viewport-width sizing fits a layout and when scrollbars or unbounded font scaling make it troublesome.
Read how CSS in Depth, Second Edition explains viewport width unit →
Web Design Playground, Second Edition
The vw unit is a CSS viewport-relative length unit equal to one percent of the viewport width.
- How it is used
- Uses vw for horizontal measurements that should scale with the browser viewport rather than a parent element.
- How deep it goes
- Explains viewport-relative sizing, numeric conversion, and percentage contrast without developing a complete vw implementation.
- Examples
- Uses a 1,600-pixel viewport calculation and contrasts a child sized at 75% of its parent with viewport-relative sizing.
- What you can do after
- Apply vw to horizontal measurements that need to scale with viewport width.
Read how Web Design Playground, Second Edition explains viewport width unit →
Also covered in
What to know first
- viewportA viewport is the visible region of a browser or graphical interface in which a document or other content is displayed.
- proportionA ratio expressing a quantity relative to a whole or reference quantity, commonly represented as a fraction, decimal, or percentage.
- pixelA pixel is either a discrete image sample carrying visual information at a raster location or, in CSS, an abstract reference unit for rendered dimensions.
- emThe em is a CSS relative length unit whose computed value is based on the applicable font size.
Related concepts
- viewportuses · A viewport is the visible region of a browser or graphical interface in which a document or other content is displayed.
- dynamic viewport unitincludes · A dynamic viewport unit is a CSS viewport unit whose resolved size tracks the viewport as browser interface elements appear or disappear.
- small viewport unitincludes · A small viewport unit is a CSS viewport-relative unit based on the corresponding dimension of the small viewport.
Questions about viewport width unit
What is viewport width unit?
The CSS vw unit is a viewport-relative length equal to one percent of the viewport width.
Which Manning books explain viewport width unit?
Math for Web Design, CSS in Depth, Second Edition and Web Design Playground, Second Edition.
What should I know before learning viewport width unit?
Manning books that teach viewport width unit usually introduce viewport, proportion, pixel and em first.
What kinds of viewport width unit are there?
Kinds of viewport width unit include dynamic viewport unit, large viewport unit, small viewport unit, vmax and vmin/vmax unit.
What is viewport width unit also called?
Viewport width unit is also called vw or viewport unit.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


