views:

64

answers:

3

Hello,

I was wondering if it's possible to affect the positioning of the body; I have a 500 x 500 pixel image I have positioned in the center of the page, set not to repeat. I was wondering if it's possible to skew the positioning somehow so that it appears 20 pixels down from the center, as I have a larger header that overlays the background.

Any ideas?

Thanks.

+1  A: 

Make your background image 40px taller at the top. That will shunt the image down 20px.

You could try hacking around with divs and margins but making the image taller has the same effect without causing hair-loss.

Oli
I was just typing that! +1
jball
Really good idea, will come in useful later. Thanks.
Brian
A: 

Investigate the use of background-position rule in CSS. It takes 2 values, separated by a space, like so:

background-position: left center;

or

background-position: 50px 100px;

They are in X Y order.

Robusto
Read the question. He wants an offset *from the center*.
Oli
+1  A: 

If you are not particular about offsetting exactly 20px you can use a percentage to offset the y coordinate of the background. Here is an example:

background-position:50% 55%;

Here is a link for more info: http://www.sitepoint.com/blogs/2007/07/05/css-using-percentages-in-background-image/

orandov
Worked like a charm, thanks.
Brian