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 for Mac 创建的dnsmasq容器连不上/不工作的问题2. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?3. docker api 开发的端口怎么获取?4. 前端 - 类到底该如何去命名 .newsList 这种的命名难道真的不是过度语义化吗?~5. docker网络端口映射,没有方便点的操作方法么?6. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?7. docker容器呢SSH为什么连不通呢?8. spring-mvc - spring-session-redis HttpSessionListener失效9. docker start -a dockername 老是卡住,什么情况?10. javascript - 关于用户登录和信息存储的问题

网公网安备