1.設置全局選擇器
*{
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
2.設置html與body
html,body{
height: 100%;
}
3.實現上中下結構的自適應實例展示:
.header{
background: red;
height: 140px;
margin-bottom: -140px;
position: relative;
}
.mid_content{
background: gold;
min-height: 100%;
padding: 140px 0px 150px 0px;
}
.footer{
background: blanchedalmond;
height: 150px;
margin-top: -150px;
}
4.效果展示,不管界面大小怎麼改變,上中下結構始終不變.