2013-02-22 68 views
0

我正在嘗試用div隔開2個頁面。其中1個是內容,另外1個是側邊欄。css在左邊修復了div

側欄必須位於左側。

這裏是我目前使用的做它的代碼:

#SideBar 
{ 
float: left; 
width: 300px; 
background-color: #727272; 
height: 100%; 
position: absolute; 
top: 0px; 
bottom: 0px; 
left: 0px; 
} 

#Content 
{ 
float: left; 
right: 0px; 
top: 0px; 
bottom: 0px; 
position: absolute; 
left: 300px; 
padding: 3px; 
font-size:12px; 
overflow:auto; 
} 

第一次它似乎正常工作,但是當我去恢復下降(調整)我的瀏覽器,它brokes。

位於側邊欄的div溢出。是的,我正在討論側欄的內部元素。

爲什麼側邊欄不能固定在左側?

在此先感謝。

編輯:

我的HTML是:

<div id="SideBar"> 
Sidebar content goes here 
</div> 
<div id="Content"> 
Main content goes here 
</div> 
+0

你是什麼意思溢出? – Oliver 2013-02-22 22:53:40

+0

你能告訴我們你的HTML嗎? – 2013-02-22 22:53:54

+0

@TurnItUp問題是,我不明白你的問題。 :-) – Oliver 2013-02-22 22:56:22

回答

0

按照下面的評論,添加最小高度屬性應該解決它。

+0

內容不在邊欄內。 – TurnItUp 2013-02-22 23:00:24

+0

因此,內容與側邊欄的右側對齊,如果這樣的話放在浮動狀態:對吧? – 2013-02-22 23:04:37

+0

float:沒有解決。 – TurnItUp 2013-02-22 23:17:47