问题:布局一共就2块,上面是header,下面是section做container,放其余的东西。都用的百分比布局,具体这么写的
代码:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=0">
html,body{
height:100%;
}
*{
margin: 0;
padding: 0;
}
.header {
background-color: rgb(0,108,209);
height:15%;
width:100%;
position: fixed;
top:0;
}
.section{
padding-top: 25%;
color: red;
}
最后写出来要么header和section有空隙要么重叠。所以那个section的padding-top怎么设置才好呢?
第一次修改:发现用px做单位就可以,那么为什么用百分比不可以呢?
你的header,height:15%.下面的section 应该padding-top:15%