2013-02-22 70 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