移動端頁面rem布局的關鍵點。

來源:互聯網
上載者:User

標籤:直接   view   img   ice   大小   處理   注意   height   imu   

移動端頁面配置的關鍵點。

第一.rem布局:

1,必須寫

<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
2, 特別注意:對於移動端頁面的 banner圖 用img前景圖做。特別要對 <img class="img">標籤要做處理
<img class=‘img‘/>
.img{
display:block;//圖片轉為塊
width:100%;  //寬度設為100%
height: //單位要改為rem
}

3,黑體字必須寫
*{margin: 0;padding: 0;}
////////////一下是移動端頁面必須寫的/////////////////////////////////////
html{font-size:100px; }/*目的是讓100px單位直接換算成1rem處理。*/
#app{ //最外面的div盒子
font-size:0.16rem; //字型大小
//position: relative;
position: absolute;
left: 0;
right: 0;
top:0;
bottom:0;
overflow: hidden;
////////////////////////////////////////////////
#head{
position: absolute;
top:0;
left: 0;
width: 100%;

background: green;
height: 48px;
line-height: 48px;
text-align: center;

h1{
color: white;
}
}
#section{

width: 100%;
/*-----讓中間內容撐到最上面和最下面 出現豎向捲軸---------------*/
position: absolute;
bottom: 0;
top:0;
overflow-y: scroll;
/*-----------結束--------*/
margin-top: 48px;
margin-bottom:44px;

ul>li{
font-size: 40px;
}
}
#foot {
position: absolute;
left: 0;
bottom: 0;
width: 100%;

height: .44rem;
text-align: center;
line-height: .44rem;
background: #00f;
display: flex;
a{
display:inline-block;
z-index: 11;
flex:1; /*給每一個a平均分配 flex:1*/
color: #fff;
}
}
}

移動端頁面rem布局的關鍵點。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.