Search for:

Relative Lengths

Relative Lengths

Relative length units specify a length relative to another length property. Relative length units scale better between different rendering medium.

UnitDescription
emRelative to the font-size of the element (2em means 2 times the size of the current font)Try it
exRelative to the x-height of the current font (rarely used)Try it
chRelative to the width of the “0” (zero)Try it
remRelative to font-size of the root elementTry it
vwRelative to 1% of the width of the viewport*Try it
vhRelative to 1% of the height of the viewport*Try it
vminRelative to 1% of viewport’s* smaller dimensionTry it
vmaxRelative to 1% of viewport’s* larger dimensionTry it
%Relative to the parent element

https://www.w3schools.com/cssref/css_units.php

Leave A Comment

All fields marked with an asterisk (*) are required