首页 > 开发 > HTML > 正文

HTML5 的媒体查询用多了好么?

2017-09-09 13:56:14  来源: 网友分享

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来设定大小,宽度,高度。