3 回答

TA貢獻1843條經驗 獲得超7個贊
移動端頁面添加上下面的meta
<meta name="viewport" content="width=device-width, initial-scale=1" />
如果要禁止用戶的縮放,請自行查詢文檔后添加
然后盡量不要使用px作為單位,除了border-width, outline-width, border-radius等只需要微量單位的屬性外,多使用em, %, rem做單位, 尤其是字體。這種處理是不需要媒體查詢的,真正用到媒體查詢的東西不會太多的,主要是在布局上可能會有些媒體查詢的東西存在。

TA貢獻1803條經驗 獲得超6個贊
媒體查詢配合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
來設定大小,寬度,高度。
- 3 回答
- 0 關注
- 1202 瀏覽
添加回答
舉報