https://github.com/lianbinghua

两列布局,一列定宽,一列宽度自适应

方法一:

body{
margin: 0;
}
.container{
height: 300px;
overflow: hidden;
}
.left{
width: 200px;
height: 300px;
background: red;
position: absolute;
left:0;
top: 0;
}
.right{
margin-left:200px;
width: 100%;
height: 300px;
background: green;
}

<div class="container">
<div class="left"> </div>
<div class="right"> </div>
</div>

方法二:

body{
margin:0;
}
#wrapper{
height: 300px;
overflow: hidden;
}
.left{
width: 200px;
height: 100%;
background: red;
float: left;
}
.right{
width: 100%;
height: 100%;
float: right;
background: green;
margin-right: -200px;
}

<div id="wrapper">
<div class="left">
</div>
<div class="right">
</div>
</div>

 

posted @ 2014-08-18 11:14  连冰华  阅读(481)  评论(0编辑  收藏  举报