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. 前端 - 提问关于background-image不显示的问题2. mysql sql where id in(25,12,87) 结果集如何用按照 25 12 87排序?3. javascript - 在top.jsp点击退出按钮后,right.jsp进行页面跳转,跳转到login.jsp4. javascript - 如何在外部点击,跳转到网页后,显示指定的模块。5. android自带时钟应用的这个效果是怎么做的6. 使用未定义的常量user_id-假定为“user_id”7. javascript - app中集成轻量级富文本编辑器?8. atom开始输入!然后按tab只有空格出现没有html格式出现9. python - Flask 脚本,运行一段时间后无响应10. css - 关于background-position百分比的问题?

网公网安备