in
- em is a relative unit, it needs a reference attribute, which refers to the font size of the current element
- Reference value: the value of the font-size of the HTML root tag
rem
- relative unit of rem,
- Reference value: the value of the font-size of the HTML root tag
- The principle of rem layout:
dynamically modify the font-size value in the html root tag.
Implementation method:
1. Through js
2. Through vw.
vw / vh
-
There are also disadvantages to using percentage layout:
1. It is inconvenient to calculate the percentage.
2. It is not convenient to use when multi-layer nesting. -
vw: 1vw = one hundredth of the screen width.
vh: 1vh = one hundredth of the screen height. -
Difference: The
percentage refers to the parent box
vw/vh refers to the screen.