第一种方法:
<div id="head">head</div>
<div id="wrap">
<div id="diva">diva</div>
<div id="divc">divc</div> <!--注意divc在divb的前面-->
<div id="divb">divb</div>
</div>
<div id="foot">foot</div>
#head{height: 35px;
background: #ccc;}
#diva{width: 100px;
background: red;
height: 30px;
float: left;}
#divb{
height: 30px;
background: green;
margin 0 100px;
}
#divc{height: 30px;
width: 100px;
background: yellow;
float:right;
}
#foot{height: 35px;
background: #eee;}
第二种方法:
<div id="head">head</div>
<div id="wrap">
<div id="diva">diva</div>
<div id="divb">divb</div>
<div id="divc">divc</div>
</div>
<div id="foot">foot</div>
#wrap{position: relative;}
#diva{width: 100px;
background: red;
height: 30px;
position: absolute;
left: 0;
}
#divb{
height: 30px;
background: green;
margin 0 100px;
}
#divc{height: 30px;
width: 100px;
background: yellow;
position: absolute;
right: 0;
}
#foot{height: 35px;
background: #eee;}