最近我在编写一个网页,遇到了一个非常烦人的问题。
我的侧边栏高度为 100%,但是当我将浏览器分辨率调整为 150% 并一直滚动到底部时,我看到我的屏幕和我的 div 标签之间有一个巨大的差距。
截图 http://i58.tinypic.com/wrkl5y.png
我的 CSS
html {
padding: 0;
margin: 0;
height: 100%
}
body {
background: url(images/bg.png) #f7f7f7;
margin: 0 auto;
padding: 0;
width: 1080px;
min-height: 100%;
overflow:hidden;
}
html, body{
min-height:100%;
height:100%;
}
#nav {
background: url(images/navigacija.png) repeat-y;
position: absolute;
min-height:100%;
height:100%;
top:0; bottom:0;
left: 0;
}
对不起我的英语,谢谢那些愿意帮助的人。
最佳答案
尝试将 #nav 高度设置为 auto 而不是 100% 并删除 min-height 属性。像这样:
#nav {
background: url(images/navigacija.png) repeat-y;
position: absolute;
height:auto;
top:0;
bottom:0;
left: 0;
}
关于HTML CSS : div element height 100% when resized to + resolution,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26640662/