Relative unit

Updated: 10/03/2024 by Computer Hope

With measurements, a relative unit is a measurement that changes relative to another value. For example, with font sizes, em and rem (root em) are relative unit fonts. Unlike a font that is an absolute unit, these units are relative to the root value. With HTML (HyperText Markup Language), the root tag is the <html> tag. With CSS (Cascading Style Sheets), if a font size is defined in the root, it becomes the relative value of all other fonts using the rem use. In other words, if the root font size is 16px, 1rem equals 16px, and 2rem (double) equals 32px. Below is an example of how the H1 heading of a web page can be doubled using a rem size in CSS.

h1 {
font-size:2rem;
}

Measurement, Relative, Typography terms, Unit