国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

CSS3中媒體查詢結合rem布局適配手機屏幕

2024-07-11 08:40:16
字體:
來源:轉載
供稿:網友

css3語法: (750px設計圖的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設計圖的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布局適配手機屏幕,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復大家的!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南充市| 阿克| 宜良县| 甘洛县| 离岛区| 鸡东县| 双城市| 阳山县| 平定县| 景洪市| 宝坻区| 舒兰市| 甘谷县| 五大连池市| 出国| 普陀区| 沾益县| 景德镇市| 福建省| 罗平县| 鄂温| 商城县| 蒙城县| 沧州市| 鄂州市| 平江县| 旅游| 阳泉市| 塔城市| 涞水县| 舟山市| 屏南县| 道孚县| 四川省| 邵阳县| 阿拉善左旗| 金阳县| 六安市| 临夏市| 通州区| 北安市|