css3移动端布局
问题描述
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>
问题解答
回答1:这种布局使用 flex 再合适不过了。
csshtml,body { height: 100%;}body { margin: 0;}article { height: 100%; display: flex; flex-direction: column; text-align: center;}header { height: 50px; background: #ccc;}footer { height: 50px; background: #ccc;}section { flex: 1; background: #eee;}
前缀使用 autoprefixer 自动生成,浏览器的兼容性很理想。下面是 codepen 中的效果:
http://codepen.io/yuezk/pen/NqEqVv
相关文章:
1. javascript - 在top.jsp点击退出按钮后,right.jsp进行页面跳转,跳转到login.jsp2. 使用未定义的常量user_id-假定为“user_id”3. mysql sql where id in(25,12,87) 结果集如何用按照 25 12 87排序?4. javascript - 如何在外部点击,跳转到网页后,显示指定的模块。5. 前端 - 提问关于background-image不显示的问题6. mysql - 记录开始时间和结束时间,表字段类型用timestamp还是datetime?7. 看不懂你这一步的操作8. atom开始输入!然后按tab只有空格出现没有html格式出现9. css - 关于background-position百分比的问题?10. 这个java项目有一个首页地址是微信前台的,这个所谓的微信前台指的是什么?

网公网安备