css3语法: (750px设计图的1rem = 100px)
@media only screen and (min-width: 320px) and (max-width: 479px){
ht ML {
font- Size: 42.67px !important;
}
}
@media only screen and (min-width: 480px) and (max-width: 639px){
html {
font -s ize: 64px !important;
}
}
@media only screen and (min-width: 640px) and (max-width: 749px){
html {
font-size: 85.34px !important;
}
}
@media only screen and (min-width: 750px) and (max-width: 959px){
html {
font-size: 100px !important;
}
}
@media only screen and (min-width: 960px) and (max-width: 1241px){
html {
font-size: 128px !important;
}
}
@media only screen and (min-width: 1242px){
html {
font-size: 165.6px !important;
}
}
js控制
(zepto / jq uery)(750px设计图的1rem = 100px)
function setFont() {
let window_width = window.innerWidth;
let font_size = parseFloat(window_width / 3.75);
$('html').css('font-size', font_size);
}
$(window).on('resize', function () {
setFont();
});
总结
以上所述是小编给大家介绍的CSS3中 媒体查询 结合rem布局适配手机屏幕, 希望对大家有所帮助 ,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
总结
以上是 为你收集整理的 CSS3中媒体查询结合rem布局适配手机屏幕 全部内容,希望文章能够帮你解决 CSS3中媒体查询结合rem布局适配手机屏幕 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
查看更多关于CSS3中媒体查询结合rem布局适配手机屏幕的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did200832