正文宽度为页面而非屏幕的 100%

发布于 2024-12-19 16:35:56 字数 490 浏览 2 评论 0原文

我的页面正文中有一个背景图像设置在右下角。但是,当页面内的内容超出屏幕时,背景图像会停止在屏幕边缘,而不是实际内容结束的位置。

这是相关的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺孤伤于心 2024-12-26 16:35:56

如果您还没有,则需要将网站内容包装在一个包含 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 that div, instead of putting it on the body.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文