我已經創建了一個非常簡單的網頁佈局,可以在這裏看到:http://s361608839.websitehome.co.uk/greengold/www/index.html正如你所看到的,似乎有一個問題。 div #rightcol似乎被左邊的頂部div(#leftcolbanner)按下了頁面。CSS浮動造成內容被推下一個HTML頁面
的CSS的#leftcolbanner是:
#leftcolbanner{
width: 707px;
height: 266px;
float: left;
background: url(../images/banner_home.gif) no-repeat;
margin: 20px 0 20px 20px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #e1dbce;
}
和#rightcol:
#rightcol{
width: 190px;
background: #f4f2ec url(../images/bg_rightcol.gif) no-repeat right bottom;
float: right;
min-height: 550px;
padding: 25px;
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
border-left: 1px solid #e1dbce;
}
#leftcolbanner的寬度不應該是問題,爲什麼#rightcol被按下。這似乎是我的經驗中唯一的原因,但這次並非如此。
任何人都可以看到任何我看不到造成這種情況嗎?
非常感謝
這適用於我。謝謝。你能解釋它是如何工作的嗎? – 2013-09-27 06:59:03
@JayantVarshney我知道這是遲到了,我不是瀏覽器開發專家或任何東西,但這是我的猜測:瀏覽器從上到下讀取它,然後在確定要呈現的佈局時「預留」該項目的空間。在#rightCol之前使用#leftCol,它將獲得「最高優先級」,並且#leftCol在爲#rightCol保留空間之前使用該整個***區域,從而將#rightCol降低。我認爲一些瀏覽器會「返回」並正確顯示它。 [從以往的經驗],我相信Firefox可以迴歸,但Chrome不會。 – 2014-02-16 21:02:59