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. docker 17.03 怎么配置 registry mirror ?2. docker 下面创建的IMAGE 他们的 ID 一样?这个是怎么回事????3. mac连接阿里云docker集群,已经卡了2天了,求问?4. vue 子组件watch监听不到prop的解决5. java - Web开发 - POI导出带有下拉框的Excel和解决下拉中数组过多而产生的异常6. 上传图片老是失败是什么原因?SAE_TMP_PATH.后面跟的路径在哪看7. mobile-web-design - html5 touchmove 怎么获取经过的元素?8. html5 - weex H5端的使用,怎么跑起来?9. javascript - [React Native]如何在Tabs内维护每一个ListView的滚动条?10. 为啥总显示密码错误
