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. redis sentinel怎么跑守护进程以及日志记录位置的?2. 在windows下安装docker Toolbox 启动Docker Quickstart Terminal 失败!3. javascript - sublime快键键问题4. 前端 - 这段代码一直生效不了,查半天因为 top: 0px; 分号后一个隐藏的东西,也不是占位符...删了就可以生效,这是什么情况。。5. django - Nginx uwsgi 进程问题6. javascript - 解释下这种函数定义7. 百度地图api - Android百度地图SDK,MapView上层按钮可见却不可触,怎么解决?8. html5 - ElementUI table中el-table-column怎么设置百分比显示。9. javascript - 爱加密的HTML5应用加固服务是什么原理?10. 关于纯用css写导航鼠标移入事件的问题?

网公网安备