...

View Full Version : Postioning centered horizonally, specifiying the vertical positioning.



cartoongeorge96
02-01-2012, 02:54 PM
Alright, so what i want to do it center an image using CSS (or whatever will be most efficient).

I need it to be centered horizontally, but need to specify the vertical positioning, ie 200px from the top. - I am attempting it this way to the images don't shunt when the browser window is re-sized (or i would embed it normally). Am i thinking correctly?

Many thanks

george

abduraooft
02-01-2012, 03:36 PM
image is an inline element by default, so you could centre it horizontally be setting a text-align:center; to it's parent block level element.

cartoongeorge96
02-01-2012, 04:19 PM
image is an inline element by default, so you could centre it horizontally be setting a text-align:center; to it's parent block level element.

Thanks for the reply.

I was just trying to workout how to implement what you suggested, i imagine it's something like this:


#image2
{
text-align:center;
background-position: center 200px,
background-image:url(/images/content_top.png);
background-repeat:no-repeat

I'm 90% sure that's wrong somewhere, i'm new to CSS, please correct me! :)

Thanks again

abduraooft
02-02-2012, 05:54 AM
Can we have a link to your page?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum