Quote:
Originally Posted by lmilesw
You can't have two background images if one of them is sized to cover the full area.
|
Hi Larry, I believe you can have more than two background images, as long as you layer them correctly. If one of them is to cover the whole area, you need to make sure you put it at the bottom.
For instance on
my website I use this CSS in Body, text and links
Code:
background: url("/images/personal-website-design-brighton-sussex.png") top left no-repeat,
url("/images/personal-website-design-brighton-sussex-header.png") top left repeat-x,
url("/images/personal-website-design-brighton-sussex-footer.png") bottom left repeat-x,
url("/images/noise.png") repeat;
- 1st image is my logo on a transparent background, to ensure this always stays in the top left corner
- 2nd image is my header image which is repeated at the top to the left to accommodate all screen sizes (although not perfect on very large screens, I am happy with it)
- 3rd image is my footer which is repeated at the bottom and to the left to do the same as the header
- 4th lastly is my background noise image to slot in below all the other images
The only flaw with this is that it doesn't work in IE (as always), because IE only allows one image per CSS selector, so it would only show the top one (in my case the logo and my website would have a white background).. to get around that I have put the following in my HTML Inserts: Header
HTML Code:
<!--[if lt IE 10]> <link rel="stylesheet" type="text/css" href="/ie8.css" /> <![endif]-->
(For those who don't know: this means for IE lower than IE 10, please use this style instead.)
in the separate stylesheet I have used the following CSS:
Code:
body {
background: url("/images/personal-website-design-brighton-sussex-header-logo.png") repeat-x scroll left top !important;
}
html{
background: #ccc url('/images/personal-website-design-brighton-sussex-footer.png') repeat-x scroll left bottom !important;
z-index: 2 !important;
}
This is a different header image that includes my logo in the left in the body and a grey background and footer image in the html. I used z-index 2, because otherwise it wouldn't show
Rather than using a separate style sheet, you could also put this in your HTML Inserts: Header
Code:
<!--[if lt IE 10]>
<style type="text/css">
<!--
body {
background: url("/images/personal-website-design-brighton-sussex-header-logo.png") repeat-x scroll left top !important;
}
html{
background: #ccc url('/images/personal-website-design-brighton-sussex-footer.png') repeat-x scroll left bottom !important;
z-index: 2 !important;
}
</style>
<![endif]-->
I hope that makes sense and would help someone else trying to do the same!