rem 的根标签是html
以html标签上设置的font-size的值为参考点
如:
<div id="app">
<div id="son></div>
</div>
html{ font-size:20px; }
#app{
width :4rem; ===>4*20=80px
}
#son {
width :2rem; ===>2*20 =40px
}
如果html的font-size 的值能随便屏幕的大小变化而变化
em 根据父元素改变值
以父元素为参考点
比如:
<div id="app">
<div id="son></div>
</div>
#app{
font-size:10px;
}
#son{
font-size:1em; ==>1*10=10px
}
物理像素和css像素
正常情况下 1物理像素=1css像素
放大的时候 1css像素=3物理像素,会模糊