Click to See Complete Forum and Search --> : picture in center of screen


haynbrian
09-13-2003, 06:05 PM
Hey all,

How can I make an image appear in the center of the screen (horizontally and vertically), no matter what the resolution. I know how to center horizontally, but how about vertically?

Thanks,

Brian

Bungholio
09-13-2003, 11:00 PM
do you mean the background or just an image on the page??

for the background its something like

body (background:#FFF url(bg.gif) center middle;}

for just an image on the page. your more likely to have x-browser compatibility using tables

<table width=100% height=100%><tr>
<td align=center valign=middle>
<img>
</td></tr></table>

if you want to put it in a layer (<div>) or something, there is another way, using negative margins, just let us know ...

good luck

pyro
09-13-2003, 11:58 PM
http://www.infinitypages.com/research/verticalcentereddiv.htm can easily be applied to an <img> rather than the <div> that I used in my example...

haynbrian
09-14-2003, 10:30 PM
Thank you! Thats exactly what I was going for!

Brian

pyro
09-14-2003, 10:50 PM
You bet. I'm happy to help... :)