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. 为什么span的color非要内联样式才起作用?2. javascript - swiper.js嵌套了swiper 初始设置不能向下一个滑动 结束后重新初始3. python - Django ManyToManyField 字段数据在 admin后台 显示不正确,这是怎么回事?4. docker - 如何修改运行中容器的配置5. python - 如何修改twisted自带的日志输出格式?6. 求救一下,用新版的phpstudy,数据库过段时间会消失是什么情况?7. 请问一下各位老鸟 我一直在学习独孤九贱 现在是在tp5 今天发现 这个系列视频没有实战8. 在cmd下进入mysql数据库,可以输入中文,但是查看表信息,不显示中文,是怎么回事,怎新手,请老师9. 如何使用git对word文档进行版本控制?10. 高并发写入和更新mysql

网公网安备