0

我正在尝试做由 div 分隔的 2 面页面。其中1个是内容,另一个是侧边栏。

侧边栏必须位于左侧。

这是我目前用来执行此操作的代码:

#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;
}

第一次它似乎工作正常,但是当我去恢复(调整大小)我的浏览器时,它坏了。

位于侧边栏中的 div 溢出。是的,我说的是侧边栏的内部元素。

为什么侧边栏不固定在左侧?

提前致谢。

编辑:

我的html是:

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

1 回答 1

0

根据下面的评论,添加 min-height 属性应该可以解决它。

于 2013-02-22T22:53:13.917 回答