Forum Moderators: open

Message Too Old, No Replies

How to centre page background.

         

ThomasAJ

4:59 am on Aug 31, 2009 (gmt 0)

10+ Year Member



I saw a website that had a picture as a background which remained centred horizontally as I moved the right hand edge of my window. Normally my pictures are aligned top-left corner.

It used something like:

<Body id="body"

and then MUCH further down there was:

body {background:#000 url(../../Web%20Images/MPA_Background1.gif) no-repeat 50% 10px}

But I do not know where to place "body {backg..."

I presume '50%' controlled the centering.

swa66

3:20 pm on Aug 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the background CSS rule is a shorthand for a.o. background-position:
[w3.org...]

50% 10px would seen as centering horizontally and moving it down 10 pixels.

ThomasAJ

4:35 am on Sep 1, 2009 (gmt 0)

10+ Year Member



Thanks