Is this bad practise when using a background?

Hi

Was wondering if it’s bad practise to use an image as a background. I ask this because some people like to use multiple images on a background and it seems that css only allows you to use one image per background, for example if you are using a gradient. e.g (background-image:…/gradient.jpg; } background-color:#000:wink:

What’s the best way to use a background when the background requires multiple images?

Thanks

CSS3 allows for multiple background images on a single element, and this is well supported in the latest browsers. But an alternative it to have divs within divs, each with its own background image.

There are lots of options. :slight_smile:

Thanks Ralph,

Im a bit confused as to how this would be written in the css. Would the divs go under #body like this?

.div_background1{
background-image:…/img1.jpg;
}
.div_background2{
background-image:…/img2.jpg;
}
.div_background3{
background-image:…/img3.jpg;
}

That would work if you structured your HTML like this:

<body>

<div class="div_background1">
  <div class="div_background2">
    <div class="div_background3">
    </div>
  </div>
</div>

</body>

Or you can try out CSS3 multiple backgrounds.

That’s great.

Thanks for your help.

No problem! Please post back if you have any issues or other questions. :slight_smile: