View Full Version : CSS & Multiple Backgrounds

10-02-2004, 02:31 PM
Wouldn't it make sense for CSS to be able to support multiple backgrounds on the same element? Wouldn't this eliminate the majority of superfluous markup on our pages?

The way I see it working is like this:

elm {
background: url('header.png') repeat-x top left;
background: url('footer.png') repeat-x bottom left;

Both rules would be applied. While now they overwrite each other, I think the mechanism for overwriting should be the mere presence of a background colour including the 'transparent' keyword.

elm {
background: url('header.png') repeat-x top left;
background: transparent url('footer.png') repeat-x bottom left;

The second rule would overwrite the first.

There may be a better way to implement it, but this is the first any only method that popped into my head, aside from background[] = ..., which would just be crazy.

So what do you all think? Is the general public even able to suggest things like this to the W3C, or what? I just think it makes sense...

10-02-2004, 03:02 PM
You could always use one background on the html element and one on the body element or similar. In CSS3 you can use the ::outside pseudo element specified in CSS3 Generated and Replaced Content Module (http://www.w3.org/TR/css3-content/).

10-02-2004, 03:16 PM
I think ::outside's probably closest to what I'm suggesting, but I think UA's could implement my method far more easily than the ::outside way.

Tasks like the one shown here: http://www.alistapart.com/articles/customcorners2/ would be doable with a single div, and even NO children. Legible markup at last.

I just highly doubt that something like ::outside would be implemented before redefining an already-existing property (background).

One day, maybe... *sigh*