正文宽度为页面而非屏幕的 100%
我的页面正文中有一个背景图像设置在右下角。但是,当页面内的内容超出屏幕时,背景图像会停止在屏幕边缘,而不是实际内容结束的位置。
这是相关的 css:
html, body {
margin : 0;
padding : 0;
font-family : arial, sans-serif;
background-color : #15242d;
height: 100%;height:auto;
min-width: 100%;width:auto;
font-size: 15px;
color: #959595;
}
body {
background-image : url(images/body_bkg.gif);
background-repeat: no-repeat;
background-position:right bottom;
}
解决此问题的最佳方法是什么?
I have a background image in the body of my page set to bottom right. But when the content within the page stretches beyond the screen the background image stops at the edge of the screen instead of where the actual content ends.
Here's the relevant css:
html, body {
margin : 0;
padding : 0;
font-family : arial, sans-serif;
background-color : #15242d;
height: 100%;height:auto;
min-width: 100%;width:auto;
font-size: 15px;
color: #959595;
}
body {
background-image : url(images/body_bkg.gif);
background-repeat: no-repeat;
background-position:right bottom;
}
Whats the best way to get around this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您还没有,则需要将网站内容包装在一个包含
div
中,该 div 将扩展到内容的大小。然后,您需要将背景图像应用到该div
上,而不是将其放在body
上。If you don't already have one, you need to wrap the content of your website in a containing
div
which will expand to the size of the content. Then you need to apply the background image to thatdiv
, instead of putting it on thebody
.