Many documents are always said to use REM to set the HTML font-size, with EM to set the body font-size
Looked at the next bootstrap style sheet, HTML {font-size:62.5%;} body {font-size:14px;}, speak of these two main.
The explanations are as follows:
Because the use of EM and REM is not affected, because REM is to refer to your HTML font-size, tube your body set not set, it's all right with me.
First, then if you are certain that you want to use REM units, follow these three steps to calculate:
1, determine the base: General 10px, you remember the line, do not write into the code
2, HTML {font-size: percent;} Percent score = radix/16
Base 1000 score 62.5%
Base 1400 score 87.5%
3. px conversion REM formula = desired PX Value/cardinality
That is, when you set the HTML {font-size:62.5%;}, you want to set the font size 14px for the text in the container, and convert it to REM is 14px/10--1.4rem
(If you want to test, take the Firefox firebug test, because the size of chrome below 12px failure ha, if you want to set the size of less than 12px, Chrome also has a solution, Baidu is good)
Second, if the use of EM units, the computer will go to find your body settings, do not care how HTML is set?
For example, our great bootstrap to body {font-size:14px;} so set, if I want a 14px margin, I will use 14px/14px--1em so.
The above is my own summary, if there are errors, welcome you to correct me Oh ~ ~
Use of REM, EM units on the mobile side