PX: Relative to the display screen resolution
EM: The font size relative to the parent element
REM: Font size relative to root node (i.e. HTML tag)
Browser default font Size: 16px
{font-size:62.5%; /* 10÷16x100% = 62.5% is only convenient for calculation, but chrome now minimum font size 12px can be directly with PX, set font-size:20px; then 1rem is 20px*/} {font-size:1.4rem; /**/}
Compatibility:
All browsers have REM support in addition to IE8 and earlier versions. For browsers that do not support it, the REM-set font size is ignored, and a statement of absolute units can be written at this time. Therefore consider compatibility, generally using PX, or PX and REM combination
Why is REM used on many web apps?
(1) Trouble with no EM multiple calculations
(2) make the mobile font and spacing self-adapting
A, the most common use of the mobile is, the front of a script, calculate the size of the current device, according to the size of the dynamic definition of the root element font size, so that the elements of the page definition can be adaptive changes
B, Media Inquiry method
{ HTML {font-size: 30px;} }
{ HTML {font-size: 15px;} }
{ HTML {font-size: 13px;} }
Css3:rem units