[15/06 months, 15]
EM is the relative length unit. The font size relative to the text within the current object. If the font size of the current inline text is not artificially set, the default font size is relative to the browser. (quoted from CSS2.0 manual)
The default font height for any browser is 16px. All non-adjustable browsers are compliant with: 1EM=16PX. So 12px=0.75em,10px=0.625em. To simplify the conversion of font-size, you need to declare font-size=62.5% in the body selector in the CSS, which makes the EM value 16px*62.5%=10px, so 12px=1.2em, 10px=1em, That means you just have to divide your original PX value by 10 and then put EM in as the unit.
EM has the following characteristics:
1, the value of EM is not fixed;
2, EM inherits the font size of the parent element.
So when we are writing CSS, we need to pay attention to two points:
1. The body selector declares that:font-size=62.5%; (10/16=0.625);
Body { font-size=62.5%; /* equivalent, font-size:10px (16px*0.625) */}
2. Divide your original PX value by 10, then replace with EM as unit;
3. Recalculate the EM value of the enlarged font. Avoid duplicate declarations of font size.
This is to avoid the 1.2 * 1.2 = 1.44 phenomenon. For example, when the font size of 1.2em is declared in #content, it can only be 1em when declaring the font size of p, not 1.2em, because this em is not em, it becomes 1em=12px because it inherits the font height of #content.
However, 12px Kanji exception, is obtained by the above method 12px (1.2em) size of Chinese characters in IE does not equate directly with 12px defined font size, but slightly larger. This problem Jorux has been solved, just in the body selector to change 62.5% to 63% can be displayed normally. The reason may be that when IE processes Chinese characters, the accuracy of the value of floating point is limited.
Web Response Layout