rem:相对单位,可理解为”root em”, 相对根节点 html 的字体大小来计算,CSS3 新加属性,chrome/firefox/IE9+ 支持
what’s the difference between em, px and rem ?
px: absolute unit, the page is displayed in priecise pixels.
em: relative unit, the reference point is the size of the font of the parent node. if the font-size is defined by itself. it’s calculated by itself. (the browser default font is 16px), the 1em is not a fixed value in the entire web page.
rem: relative unit, we can understand that as root em, relative to the font-size of the html of root node to calculate. and it’s a new attribute in css3, and support chrome, firefox and ie9 among others.