【发布时间】:2014-11-04 16:45:24
【问题描述】:
我在这里遇到了问题。具有 100% 高度的容器内带有标题、导航栏和内容 div 的简单布局,但我仍然得到一个垂直滚动条。
style.css
html, body {
margin: 0px;
padding: 0;
background: #E6E6E6;
}
#container{
width: 900px;
height: 100%;
position: relative;
left: 450px;
}
#header{
width: 900px;
height: 70px;
position: absolute;
background-color: #FFFFFF;
border: 1px solid black;
}
#navBar{
width: 900px;
height:20px;
position: absolute;
top: 77px;
background-color: #FFFFFF;
border: 1px solid black;
}
#content{
width: 900px;
height: 100%;
position: absolute;
top: 104px;
background-color: #FFFFFF;
border: 1px solid black;
}
【问题讨论】:
-
向我们展示相应的 HTML。
-
overflow:hidden在你不想要滚动条的容器中怎么样? -
这样做会删除一侧的边框。
-
有了这个demo fiddle 我看不到垂直滚动 - 只有水平滚动
-
@Danield 正确,但是您的示例缺少需要应用于 html 和正文的 100%,请参阅确实具有垂直滚动条的 jsfiddle.net/eevzvsdL/1。