CSS Units
There are mainly two types of ways to define sizes in CSS; absolute and relative. Absolute units are any measurement where the size will retain the same size no matter what; regardless of the other elements on screen, and screen size. The only absolute unit that should be in use is pixels, or px
.
The other, relative, change based on a few factors. When using text, you’ll want to use rem
or em
, but most likely just rem
. When using rem
for font size, you’re setting the font size of the root element, which means as scale increases so does your text.
Viewports also receive a unit of relative measurement, vh
and vw
, for viewport height and width respectively.
Link for all CSS units. Link for overview on units. Link for more info on viewports.