[問題] 請問:css區塊背景色設定的問題

看板Web_Design作者 (小嘉)時間13年前 (2013/01/02 19:04), 編輯推噓0(008)
留言8則, 4人參與, 最新討論串1/1
請問:css區塊背景色設定的問題 第一個區塊,「背景色」設定為黃底的 裡面又包了2個區塊,一左、一右 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div style="width:960px; background-color:yellow; border:none; margin:0 auto; padding:10px; text-align:center;"> <p>測試</p> <div style="float:left; width:150px; border:2px #0000ff solid; margin:5px;"> 區塊:左邊<br /> <br /> </div> <div style="float:right; width:750px; border:2px #0000ff solid;margin:5px;"> 區塊:內容<br /> <br /> </div> </div> </body> </html> 在IE8,第一個區塊背景底色,無法包到後面2個區塊 但按F12鍵,使用「IE8相容模式」又有背景底色 請問有什麼方法可以「一勞永逸」解決? 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 60.250.31.94

01/02 20:41, , 1F
01/02 20:41, 1F

01/02 20:41, , 2F
可以在 meta 限制 IE 使用的瀏覽模式。其他留給板上神人解答
01/02 20:41, 2F

01/02 20:58, , 3F
加個 clear:both 的 div 就好了
01/02 20:58, 3F

01/02 20:59, , 4F
前幾天 #1GrjsEju 這篇的第二題
01/02 20:59, 4F

01/02 21:00, , 5F

01/04 04:49, , 6F
原來是要加 clear:both就可以解決了
01/04 04:49, 6F

01/04 04:51, , 7F
總是感覺:既然是標準,這麼大牌的瀏覽器還沒支援,真是的
01/04 04:51, 7F

01/04 04:52, , 8F
總之,謝謝各位大大的解答!
01/04 04:52, 8F
文章代碼(AID): #1Gv1Gy5v (Web_Design)