简体   繁体   English

正文宽度100%页面不显示

[英]body width 100% of page not screen

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: 这是相关的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? 解决此问题的最佳方法是什么?

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. 如果您还没有,则需要将网站内容包装在一个包含div ,该div会扩展为内容的大小。 Then you need to apply the background image to that div , instead of putting it on the body . 然后,您需要将背景图像应用于该div ,而不是将其放在body

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM