欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

CSS3中媒體查詢結(jié)合rem布局適配手機(jī)屏幕

  發(fā)布時(shí)間:2019-06-10 16:22:55   作者:佚名   我要評論
這篇文章主要介紹了css3中媒體查詢結(jié)合rem布局適配手機(jī)屏幕,需要的朋友可以參考下

css3語法: (750px設(shè)計(jì)圖的1rem = 100px)

@media only screen and (min-width: 320px) and (max-width: 479px){
    html {
        font-size: 42.67px !important;
    }
}
@media only screen and (min-width: 480px) and (max-width: 639px){
    html {
        font-size: 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 / jQuery)(750px設(shè)計(jì)圖的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();
});

總結(jié)

以上所述是小編給大家介紹的CSS3中媒體查詢結(jié)合rem布局適配手機(jī)屏幕,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!

相關(guān)文章

最新評論