简体   繁体   中英

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:

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. Then you need to apply the background image to that div , instead of putting it on the body .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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