These units allow you to specify sizes in terms of percentages of the viewport width and viewport height.
The allowed units are:
vw
: hundredths of the viewport width.vh
: hundredths of the viewport height.vm
: hundredths of whichever is smaller, the viewport width or height.Here are some examples. 50vw
means 50% of the viewport width.
Don’t forget to resize your browser window to see the boxes resize automatically.
width: 50vw
.height: 25vh
.width: 25vm
.