Results 1 to 6 of 6

Thread: how to put 2 backgrounds on one page

  1. #1
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how to put 2 backgrounds on one page

    I need one background non repeating at the top of the page....

    and than another background repeating vertically however long the page gets.......

    anyone know the code for that?

  2. #2
    Join Date
    Oct 2006
    Location
    New York, NY, USA
    Posts
    262
    Thanks
    42
    Thanked 24 Times in 24 Posts

    Default Css3

    http://www.css3.info/preview/multiple-backgrounds/

    CSS3 allows web designers to specify multiple background images for box elements, using nothing more than a simple comma-separated list.

    Browser support for multiple backgrounds is relatively widespread with Mozilla Firefox (3.6+), Safari/Chrome (1.0/1.3+), Opera (10.5+) and even Internet Explorer (9.0+) all implementing the feature.
    :
    #example1 {
    width: 500px;
    height: 250px;
    background-image: url(sheep.png), url(betweengrassandsky.png);
    background-position: center bottom, left top;
    background-repeat: no-repeat;
    }
    Alternatively. you could assign one background-image to HTML element and another to BODY element -- making the BODY background transparent so HTML background can show.

  3. #3
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    I dont need transparent backgrounds..


    that doesnt work.. it doesnt even show any background images at all.

    Code:
    <style type="text/css">
    
    
    html, body {
    border:0; 
    margin: 0; 
    padding: 0; 
    background-color:#131212;
    
    
    }
    
    .example1 {
    
    background-image: url('images/bodybg.jpg'), url('images/bg.jpg');
    background-position: center top no-repeat;
    background-repeat: repeat-y center;
    background-color:#131212;
    } 
          
    </style>
    
    </head>
    
    <div class="example1">
    
    
    
    </html>
    Last edited by jscheuer1; 04-20-2012 at 02:39 AM. Reason: Format

  4. #4
    Join Date
    Nov 2009
    Posts
    107
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    I would make a <div> at the top with the image you want. Then have a wrapper around the rest of the content i.e.

    Code:
    <body...or div class="wrapper">
    <div class="someclass">Your content at the top</div>
    <div class="bgwrapper">
    
    ....
    
    page content
    ....
    
    </div>
    
    css for divs
    
    .someclass {
    background-image: url("url/toyour/img");
    }
    .bgwrapper {
    background-image: url("your/other/image");
    background-repeat: repeat;
    }
    might work for you... if you have an active version post it up.
    Last edited by itivae; 04-20-2012 at 02:52 AM. Reason: Format sorry bout that...and I missed an = sign for the second edit :)

  5. #5
    Join Date
    Apr 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    that doesnt work at all.... it just shows a real thin distorted image strip at the top of the page.. with everything else just blank white below...

    Code:
    html, body {
    border:0; 
    margin: 0; 
    padding: 0; 
    
    }
    
    
    .someclass {
    background-color:#131212;
    background: url('images/bodybg.jpg');
    background-position:center top;
    background-repeat:no-repeat; 
    }
    .bgwrapper {
    background-image:  url('images/bg.jpg');
    background-repeat: repeat-y center;
    }
    
    
    </style>  
      
    
    
    <body>
    
    <div class="someclass">Your content at the top</div>
    <div class="bgwrapper">
    
    ....
    
    page content
    ....
    
    </div>
    
    
      </body>
    </html>
    Last edited by anonperson; 04-20-2012 at 12:51 PM.

  6. #6
    Join Date
    Nov 2009
    Posts
    107
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Default

    Got a url? It makes troubleshooting easier than guessing.

Bookmarks

Posting Permissions

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