css3有什么技巧能让section的高度加上header和footer的高度正好是屏幕的高度
不能用定位的,这关系到安卓的软键盘会把页面向上顶
---css---
.indexPage{
width:100%;
height:100%;
overflow:hidden;
}
.indexPage header{
height:100px;
overflow:hidden;
}
.indexPage section{
width:100%;
overflow:hidden;
}
.indexPage footer{
height:100px;
overflow:hidden;
}
---html---
<article class="indexPage">
<header></header>
<section></section>
<footer></footer>
</article>
This layout is perfect to use
Theflex
.prefix is automatically generated using
autoprefixer
, and the browser compatibility is ideal. The following is the effect in codepen:http://codepen.io/yuezk/pen/NqEqVv