摘自w3c em unit Equal to the computed value of the ‘font-size’ PRoperty of the element on which it is used.
h1 { line-height: 1.2em }means that the line height of h1 elements will be 20% greater than the font size of h1 element. On the other hand:
h1 { font-size: 1.2em }means that the font size of h1 elements will be 20% greater than the computed font size inherited by h1 elements.
rem unit Equal to the computed value of ‘font-size’ on the root element.
When specified on the ‘font-size’ property of the root element, the ‘rem’ units refer to the property’s initial value.
新闻热点
疑难解答