Is it possible to have two background images? For instance, I'd like to have one image repeat across the top (repeat-x), and another repeat across the entire page (repeat), where the one across the entire page is behind the one which repeats across the top.
I've found that I can achieve the desired effect for two background images by setting the background of html and body:
html {
background: url(images/bg.png);
}
body {
background: url(images/bgtop.png) repeat-x;
}
Is this "good" CSS? Is there a better method? And what if I wanted three or more background images?
Current version of FF and IE and some other browsers support multiple background images in a single CSS2 declaration. Look here http://dense13.com/blog/2008/08/31/multiple-background-images-with-css2/ and here http://www.quirksmode.org/css/multiple_backgrounds.html and here http://nicolasgallagher.com/multiple-backgrounds-and-borders-with-css2/
For IE, you might consider adding a behavior. Look here: http://css3pie.com/
You could have a div for the top with one background and another for the main page, and seperate the page content between them or put the content in a floating div on another z-level. The way you are doing it may work but I doubt it will work across every browser you encounter.
use this
a simple way to adjust you every image position with background-position: and set repeat property with background-repeat: for every image individually
We can easily add multiple images using CSS3. we can read in detail here http://www.w3schools.com/css/css3_backgrounds.asp
If you want multiple background images but don't want them to overlap, you can use this CSS:
with this HTML structure:
CSS3 allows this sort of thing and it looks like this:
The current versions of all the major browsers now support it, however if you need to support IE8 or below, then the best way you can work around it is to have extra divs: