第一次寫博客,練練手。
適用於背景滿屏的情況下,ui圖給的不準(不是750*1334或則640*1136),給頁面加背景時,
document.getElementById("wrapper").style.height = document.documentElement.clientHeight + 'px' ;
要使用 height:30.15rem; (750的圖去掉微信bar就是這些,其中1rem=20px;),
還有要用 background-size: cover; 也可以使用background:100% 100%; (不要用 background:100%; UI圖不準頁面會出現半截沒背景。)
補充:html:100%, body:100%也可以
新手勿噴,謝謝。