Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS & Multiple Backgrounds

    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:

    Code:
    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.

    Code:
    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...

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think :utside's probably closest to what I'm suggesting, but I think UA's could implement my method far more easily than the :utside 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 :utside would be implemented before redefining an already-existing property (background).

    One day, maybe... *sigh*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •