View Full Version : css positioning

Feb 22nd, 2007, 10:41 AM
#background {
width: 100%;
height: 100%;
background-repeat: repeat-y;
left: 25%;
top: 30%;

ok my image is repeating but i cant seem to position it on the page how comes??

Feb 22nd, 2007, 02:04 PM
I assume you're trying to use the left and top properties to position your image? If so, that's your problem. Those will position the element, not the background.

Also, you are using background-position incorrectly. I assume you want the background image not to scroll with the page. The property you are looking for is background-attachment:fixed.

Based on my assumptions, the correct code for what you're trying to do is:

body {
background-image: url(http://www.runnerselite.com/images/linedown.jpg);
background-repeat: repeat-y;
background-position: 25% 30%;
background-attachment: fixed;

A more elegant way is to use the background shorthand, which fits it neatly on one line:

body {background: url(http://www.runnerselite.com/images/linedown.jpg) repeat-y fixed 25% 30%}

Hope this helps. Happy coding!

Feb 22nd, 2007, 02:35 PM
yes thaks it helped alot...u explain things very well thankyou