til

Understand Absolute Versus Relative Units

理解绝对单元和相对单元

Pixels are a type of length unit, which is what tells the browser how to size or space an item.

The two main types of length units are absolute and relative.

Absolute units tie to physical units of length. For example, in and mm refer to inches and millimeters. Absolute length units approximate the actual measurement on a screen, but there are some differences depending on a screen’s resolution.

Relative units, such as em or rem, are relative to another length value. For example, em is based on the size of an element’s font. If you use it to set the font-size property itself, it’s relative to the parent’s font-size.

source