PDA

View Full Version : Centering background image?



damaestro
09 Jun 2008, 05:37 AM
In dreamweaver I'm trying to figure out how I can have this starfield background (http://www.chrisjemanuel.com/) remain in the absolute center of the page. Currently it stays always on the left side as the window is resized. I want the background image to stay in the middle always as the window is resized. Can anyone please tell me how this is done? Many thanks!

Wickham
09 Jun 2008, 08:34 AM
Add background-position: top center;

body {
background-image: url(../CJE%203/bg.jpg);
background-repeat: no-repeat;
background-color: #000000;
background-position: top center;
}

or center center; if you want it centralised vertically as well, but top center seems to work OK.