How do I stop background images repeating or scrolling?

Requested and Answered by Carnuke on 2005/2/24 21:20:34

How do I stop background images repeating or scrolling?

One way to set a page background image is to set the bgsrc attribute of the body element, like this: Body of page goes here The trouble is that if the page goes on long enough, or is wide enough, the image background.png will be repeated ("tiled") throughout the page. Also, if the user scrolls the page, your background image will also scroll. If you do not want either or both of these things to happen, you will need to use styles rather than the bgsrc attribute:

<body style="background-image: url(background.png); 
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;"
>
Body of page goes here
</body>

This Q&A was found on XOOPS Web Application System : https://xoops.org/modules/smartfaq/faq.php?faqid=408