View Full Version : Background Image Repeat Down Both Sides

09-30-2007, 07:05 PM
I seriously need some help with this. I'm redesigning my detachment's website (which I am now in charge of) and have been racking my brain with this for the last few hours.

I need to have an image repeat down the left and right sides, but as you know, with html/css you can only have on background image. So here's what I have:

<style type="text/css">
body {
background:#000000 url(sidepanel.png) left top repeat-y;
#bkgnd2 {
position: absolute;
top: 0px;
right: 0px;
background:transparent url(sidepanelrev.png) right top repeat-y;
* html #bkgnd2 {

<div id="bkgnd2">

And this is what I get:
As you can see, it works, only it stops after the initial page. If I were to scroll all the way up, it looks good, but once you scroll down, the image stops repeating on the right side. Any ideas on how to fix this?

(It does this is both Firefox and IE.)

10-01-2007, 01:03 AM
Maybe it's just me, but aren't you basically just having one background, and a content container in centered? That seems to be what you're attempting, and taking that approach will make it a LOT easier for you.

10-01-2007, 02:06 AM
Yeah, just set ONE background image on the html of your site. If the image you want is slightly different on each side then as long as you have a fixed layout this will be easy. Just create an image that is wide enough to span the width of your page and have tha repeat-y... as long as you have centered your page and set the background position to center everything should line up fine too.

09-28-2011, 04:09 PM
ok, but what if you do need two different backgrounds?
I have the same background image but I need it two pixels higher on the right.
my page is 1015 pixels and centered.

I think it's easier to set the background-image on the body for the right part.
So that is what I did so far. Now I only have to find a mechanism for the left part.