PDA

View Full Version : CSS: Background image, is it possible for an image to repeat vertically starting..



burns
January 18th, 2008, 01:28 PM
from 100px from the top of the browser?

Hi,

I have a BG image for the Body tag that I have set to repeat vertically down the page but what I would like to do if possible is for the image to repeat vertically starting 150 px from the top of the page?

Is it possible? I have tried:

background-image: url('image/image.jpg')
background-repeat: repeat-y;
background-position: 50% 150px;

AFAIK this is valid code but I can't seem to get it to work, if it is at all possible?

Thanks

Marz
January 18th, 2008, 02:00 PM
Hmm..

add background-attachment: fixed;

You'll need that for background-position to work at all in Mozilla for one but after I tried for a while to test it out, I couldn't get it to repeat either..

I would suggest making a DIV with it's position fixed in a certain location... Say for instance :



<body> and then <div class='repeatyfixed'> blah blah


AS far as the body part goes, I don't think it is possible. Good luck. Also, might want to use a negative z-index to keep it behind everything but the body.

lorren.biffin
January 20th, 2008, 03:56 AM
Consider the BG image of any element to repeat in BOTH directions starting from wherever you set the starting point, so basically, you're not going to be able to get it to "start" at any certain point, unless of course you don't set it to repeat. AFAIK, there's no way around this.

The hack posted before may work, but isn't really a "best-practice" situation.

Good luck.