我有一个带有水平条的简单页面,应该与文档页面一样长。问题是,当我将浏览器窗口的大小调整到正文的最小高度以上时,滚动文档时没有显示部分栏。
搜索其他类似的问题,我发现问题可以通过将body style的margin和padding设置为0px来解决。
在我的情况下,如果我从栏的 css 中删除position:absolute ,它就会起作用。我怎样才能解决这个问题并保持酒吧绝对定位?
我需要使用绝对定位,因为我有一个占页面 100% 的背景图像的 div 元素(垂直和水平)。如果我将栏放在 div 元素之后,它不会保持原位。
<style type"text/css">
html, body
{
width: 100%;
min-width:500px;
height: 100%;
min-height:700px;
margin:0px;
padding: 0px;
}
#red {
position:absolute;
top:100px;
width:100%;
min-width:100%;
height:37%;
min-height:300px;
max-height:330px;
background: rgb(0,0,0);
margin: 0px;
padding: 0px;
}
#background
{
position:fixed;
width:100%;
height:100%;
background: rgb(56,54,0);
margin: 0px;
padding: 0px;
}
</style>
<body>
<div id="background"></div>
<div id="red"></div>
</body>
</html>