2 回答

TA貢獻1850條經驗 獲得超11個贊
代碼沒問題!換別的瀏覽器一測試就看到效果了!(瀏覽器兼容問題!!)
我用IETester試了下?。。ü烙嬆愕臑g覽器是基于IE6,IE7的)
你不加clear:both在火狐,IE8中打開??!肯定是不行的foot會浮上去!?。〉贗E6,7是顯示正常頁面??!
而加了clear:both瀏覽器所顯示的效果都一致了(IE5沒試)??!
代碼沒改就是放到一個頁面里你試試
<html>
<head>
<title> New Document </title>
<style type ="text/css">
#head{width:100%; height:20px; background:#789;}
#left{float:left; width:200px; height:300px; background:#823;}
#right{float:right; width:200px; height:300px; background:#399;}
#foot{clear:both; width:100%; height:20px; background:#789;}
</style>
</head>
<body>
<div id="head">head</div>
<div id="left">left</div>
<div id="right">right</div>
<div id="foot">footer</div>
</body>
</html>

TA貢獻1836條經驗 獲得超3個贊
#foot
{
clear:both;
width:100%;
height:20px;
background:#789;
}
你寬度已經定成了100%,什么效果。
你把寬度改成50%,再在<div id="foot"></div>下加一個<div id="foot1"></div>
他的樣式與#right
{
float:right;
width:200px;
height:300px;
background:#399;
}一樣
你這個時候再試下有clear和沒clear的區別
添加回答
舉報