HTML5的媒体查询有哪些优缺点,有的人认为最好不用。但是做页面的时候为了兼容iPhone5和6plus,经常用到啊。
谁对此有比较全面的讲解?
解决方案
媒体查询配合rem
使用。
@media only screen and (min-width: 340px){ html { font-size: 20px !important; }}@media only screen and (min-width: 401px){ html { font-size: 25px !important; }}@media only screen and (min-width: 428px){ html { font-size: 26.75px !important; }}@media only screen and (min-width: 481px){ html { font-size: 30px !important; }}@media only screen and (min-width: 569px){ html { font-size: 35px !important; }}@media only screen and (min-width: 641px){ html { font-size: 40px !important; }}
然后html
里面的DOM
根据html
来设定大小,宽度,高度。