Html代码如下
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
css如下
#a{
background:red;
height:100px;
width:100px;
float:left;
}
#b{
width:200px;
height:200px;
background:green;
}
#c{
background:yellow;
width:300px;
height:300px;
}
我做出来的是
但是书上说的是B在A的右边,求解?用google浏览器,兼容问题?
请问你的浮动代码在哪??
float:left;左浮动
clear:both;清除浮动
#a{
float:left;
background:red;
height:100px;
width:100px;
}
#b{
float:right;
width:200px;
height:200px;
background:green;
}
#c{
background:yellow;
width:300px;
height:300px;
}
浮动做不出你那种效果。。a还能浮动到b上,你用的absolute定位了吧。。css贴出来也不全
<!DOCTYPE html><style>
#a,#b,#c{float:left}
#a{
background:red;
height:100px;
width:100px;
}
#b{
width:200px;
height:200px;
background:green;
}
#c{
background:yellow;
width:300px;
height:300px;
}
</style>
<div id="a"></div>
<div id="b"></div>
<div id="c"></div>
绝对有其他代码,相对定位和绝对定位,浮动不会浮动到另外一个块级元素