css左右上下布局
2016-09-29 14:24
453 查看
左边div固定宽度,右边div宽度自适应;上边div高度固定,下面div高度自适应;效果如下:
left宽度固定150px;右边宽度自适应浏览器。right-top高度100px,right-bottom高度自适应浏览器。代码如下:
上面代码在IE里,实现上下自适应的时候有问题;right-bottom高度没有自适应浏览器。用jquery处理了一下:
left宽度固定150px;右边宽度自适应浏览器。right-top高度100px,right-bottom高度自适应浏览器。代码如下:
<!DOCTYPE html> <html> <head> <meta charset="en"> <style> html,body{width: 100%;height: 100%;padding: 0;margin:0;} #content{height: 100%;width: 100%;display: table;} .left{background-color: #99B898;width: 150px;height:100%;position: relative;top:0;left: 0;display: table-cell;} .right{position: relative;display: table-cell;} .right-top{background-color: #FECEAB;height: 100px;position: absolute;top:0;left: 0;width: 100%} .right-bottom{position: absolute;top:100px;left: 0;bottom:0;width: 100%;background-color: #FF847C} </style> </head> <body> <div id="content"> <div class="left">left</div> <div class="right"> <div class="right-top">right-top</div> <div class="right-bottom">right-bottom</div> </div> </div> </body> </html>
上面代码在IE里,实现上下自适应的时候有问题;right-bottom高度没有自适应浏览器。用jquery处理了一下:
$(".right-bottom").height($("#content").height()-$(".right-top").height())
相关文章推荐
- css实现上下左右布局
- css---flex布局中,如何响应式 得水平垂直居中?flex子元素左右 上下居中
- 上下左右布局(DIV+CSS)
- CSS布局:图片在DIV中上下左右居中(水平和垂直都居中)
- CSS布局:设置图片在DIV中上下左右居中(水平和垂直都居中)
- CSS布局,上下布局,左右布局,一列固定,剩下的自适应屏幕大小
- css布局上下左右居中大全(一)
- div+CSS完成网页布局(上下左右)
- div+css:页面整体布局居中显示:上下居中||垂直居中,左右居中||水平居中
- CSS布局:图片在DIV中上下左右居中(水平和垂直都居中)
- css实现上下左右布局
- 区块上下左右居中布局
- css+div 上下左右居中两例
- css左右自适应布局
- CSS设计网页布局(1-3-1左右固定,中间动态)示例代码
- 只用CSS实现容器内图片上下左右居中
- 只用CSS实现容器内图片上下左右居中
- 用纯CSS实现容器内图片上下左右居中
- CSS自适应布局(左右固定 中间自适应或者右侧固定 左侧自适应)
- 用CSS使图片上下左右都绝对居中于DIV