HTML样式
<div class="example">
<div class="left">left</div>
<div class="right"></div>
</div>
第一种方法:position
CSS样式
.example{
position:relation;
width:60%;
}
.example .left{
position:absolute;
left:0;
width:100px;
background:#f00;
}
.example .right{
background:#0f0;
}
第二种方法:float
.example{
width:60%;
}
.example .left{
float:left;
width:100px;
background:#f00;
}
.example .right{
background:#0f0;
}
第三种方法:display:table
CSS样式
.example{
display:table;
width:60%;
}
.example .left{
display:table-cell;
width:100px;
background:#f00;
}
.example .right{
display:table-cell;
background:#0f0;
}