Although the meaning of absolute units does not require any explanation, the relative units listed in table 2-2 need more ink.
To speak clearly.
Table 2-2 Relative values and examples
Example of unit abbreviation for relative values *
EM em height:1.2em
Ex ex Height:6ex
Percentage
Height:120%
* Example values are not equal lengths.
Both EM and ex are font-size units, but in CSS they are applied to any element as a unit of length.
First say EM, it represents the width of the letter M in a font, so its exact size depends on the word you use.
Body. And ex, equal to the height of the letter x in the given font (lowercase x represents the middle of the letter of a font)
The height of the part, excluding the letters and the prominent parts of the letter, such as D and P are out of the head.
Percentages are ideal for setting the width of the contained element, at which point the percentage is relative to the width.
Em and EX