【发布时间】:2013-01-09 16:53:31
【问题描述】:
我的问题是我的背景容器只显示到屏幕底部。在那之后的部分我看不到它。我几乎尝试了一切,但似乎没有什么对我有用。我希望它根据页面大小进行调整。
<body>
<div id="profilebg">
<!-- Other divs -->
</div>
</body>
我的 CSS 是
html, body {
height:100%;
}
#profilebg
{
position: absolute;
margin-left:10%;
margin-right:10%;
width:80%;
background-color:#ffffff;
height: 100%;
top: 0;
bottom: 0;
display: block;
}
【问题讨论】:
-
如果#profilebg 是你的后台容器,你为什么要使用绝对定位?
-
我尝试不使用绝对定位,但这也不起作用。尝试了很多东西,阅读了很多文章,我在某个地方读到了这篇文章,所以想试一试。
-
删除
position: absolute;、height: 100%;、top: 0;和bottom: 0; -
我同意,我个人尽量避免绝对定位。请使用相对定位查看我的编辑答案。
标签: css background containers