CSS viewport width (vw)
Vw stands for viewport width — a percentage of the full width of the browser window. 1vw resolves to 1% of the current viewport width. For example, if the viewport is 50cm wide, 1vw=1/2cm.
The difference between %
and vw
is most similar to the difference between em
and rem
. A %
length is relative to the containing element width, while a vw
length is relative to the full width of the browser window.
It's become very popular to use viewport units for responsive typography – establishing font sizes that grow and shrink depending on the current viewport size.