Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    1,410
    Plugin Contributions
    1

    Default CSS Question - Multiple Background Images

    I learned here: http://www.w3.org/TR/css3-background/#layering that you can layer your background images.

    I'm trying to assign to background images to a class, one positioned to the left and the other to the right, to create border effects.

    Here is the html:

    <td class="CenterBox" valign="top">

    And here is the css:

    .CenterBox {
    background-image:url(../images/Side_LeftBorder.gif), url(../images/Side_RightBorder.gif);
    background-repeat: repeat-y,repeat-y;
    background-position:left, right}

    What am I doing wrong?

    If I take out one side or the other it works, but not together.

  2. #2
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: CSS Question - Multiple Background Images

    css3 ? Have no idea how many browsers will support it ...

  3. #3
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    1,410
    Plugin Contributions
    1

    Default Re: CSS Question - Multiple Background Images

    Oops, didn't realize. Nevermind then

  4. #4
    Join Date
    Sep 2006
    Location
    West of Ireland
    Posts
    174
    Plugin Contributions
    0

    Default Re: CSS Question - Multiple Background Images

    Hi I am trying to implement the same effect. IE one image on one side of the page bg and a different one on the other.

    I'm not sure how to properly do it though.
    obviously from the above posts layering in one element is not happening yet.

    but is it possible to put one image in the <body> element, aligning it left, and define a <div> element directly inside the <body> and align it right?

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: CSS Question - Multiple Background Images

    Yep, that's exactly how you would do it.

    The second one would cover the first, in any places they overlap.

  6. #6
    Join Date
    Sep 2006
    Location
    West of Ireland
    Posts
    174
    Plugin Contributions
    0

    Default Re: CSS Question - Multiple Background Images

    Ok cheers for that, worked perfectly. One thing I note, though, is that if a refresh the page (in FF), the div contained image dissapears for longer, so the image defined in <body> appears by itself for a while.....


    code I used, for those wanting to do the same

    in templates/YOUR_TEMPLATE/common/tpl_main_page.php:
    BELOW:
    Code:
    <body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
    I entered
    Code:
    <div id=bgLayer>
    ABOVE:
    Code:
    </body>
    I entered:
    Code:
    </div>
    then in the stylsheet:
    add your first image by layer. In this case as I am layering images to create a background I am starting with body.

    add to body style:
    Code:
        background-image: url(../images/firstLayerImage.jpg);/*use relative file path*/
        background-position: top left;/*(top/center/bottom left/center/right) or (x-% y-%) or (x-pos y-pos)*/
        background-repeat: no-repeat; /*or repeat or repeat-y or no-repeat*/
        background-attachment: fixed; /*or scroll */
    then for every div I created, and every image layered I enter:
    Code:
    /*BOF bg layer div*/
    
    div#bgLayer {
        width: 100%;
        background-image: url(../images/layerImage.jpg); /*use relative file path*/
        background-position: top right; /*(top/center/bottom left/center/right) or (x-% y-%) or (x-pos y-pos)*/
        background-repeat: no-repeat; /*or repeat or repeat-y or no-repeat*/
        background-attachment: fixed; /*or scroll */
        }
    /*EOF custom bg div*/

  7. #7
    Join Date
    Dec 2006
    Posts
    32
    Plugin Contributions
    0

    Default Re: CSS Question - Multiple Background Images

    Hey...I just wanted to write in and say that this was EXACTLY what I was looking for!! I tried it and it worked perfectly in both Mozilla and IE
    Thank you SO much!!!!!



  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: CSS Question - Multiple Background Images

    Even easier, if you're not using any background image already in #mainWrapper, is to put the first (left...) background image in body and the second (right...) one in mainWrapper.
    Then no divs need to be added to the PHP code.
    This does require that mainWrapper be 100&#37; of body, or else there will be a gap around the second part.

    Another point to note: You can make all this background image smaller than the full window by giving body a border.
    border: 0 20px #112233;
    will give you strips of that color on each side of your content, somewhat similar to the effect on this forum.

  9. #9
    Join Date
    Feb 2005
    Location
    New Jersey
    Posts
    646
    Plugin Contributions
    0

    Default Re: CSS Question - Multiple Background Images

    I'm sorry...I'm really lost. No surprise there. I need two BG images also.

    One is background:URL(images/back_h_s.jpg) no-repeat right top. The other is background:URL(images/back_h.jpg) no-repeat top.
    How would I put that in the css?
    I can't seem to get it right.

    Thanks in advance for any help,
    Kelly

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: CSS Question - Multiple Background Images

    The exact answer to that depends on exactly where you want these background images to appear.

    Do you want them at the edges of the screen, in the main page content area, or elsewhere?

    A photoshopped image of what you want would be ideal.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Multiple background images?
    By jagall in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 11 Jul 2011, 09:17 AM
  2. Trouble with CSS background images
    By Wilbo in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 13 May 2009, 11:05 AM
  3. CSS for different page background images
    By jsteelethg in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 7 Mar 2007, 12:53 AM
  4. using background images in css
    By jas99villa in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Feb 2007, 10:01 PM
  5. Customizing background...not simple CSS change question...
    By g0hst in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 20 Jun 2006, 08:46 PM

Posting Permissions

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