HELP! Multiple body Background images per page

Discussion in 'CSS' started by famousartguy, Jan 12, 2011.

  1. #1
    Hello,
    I am trying to place different background images on multiple pages. I am using:
    
    
    HTML / Body {background: url(image goes here) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;}
    
    
    Code (markup):
    The problem I am facing is that I need to have MANY stylesheets to reference each pages background. So, I will have a separate stylesheet for each page I have a different image (because the background images are referenced from the HTML or Body tags). I tried to create a wrapping div, but I can't get the height 100% (the height will vary, so I can't specify that).

    Any suggestions on how I can change backgrounds per style, rather than having a ton of stylesheets with different images? Make sense?? :confused:
     
    famousartguy, Jan 12, 2011 IP
  2. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #2
    You could use Javascript to dynamically change the background image on each separate page? Here is an example:

    
    <script type="text/javascript">
    var background = "images/back1.jpg";
    document.body.style.background='url('+background')';
    </script>
    
    Code (markup):
     
    jeremyhowell, Jan 12, 2011 IP
  3. famousartguy

    famousartguy Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Getting error. How would I apply style?
     
    famousartguy, Jan 12, 2011 IP
  4. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
  5. famousartguy

    famousartguy Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Got it!

    Just going to add classes to body tag!

    DOH! of course.. haha
     
    famousartguy, Jan 12, 2011 IP