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,
Briando 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 <!-- m --><a class="postlink" href="luckhttp://www.infinitypages.com/research/verticalcentereddiv.htm">luckhttp://www.infinitypages.com/resear ... reddiv.htm</a><!-- m --> can easily be applied to an <img> rather than the <div> that I used in my example...Thank you! Thats exactly what I was going for!
BrianYou bet. I'm happy to help...
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,
Briando 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 <!-- m --><a class="postlink" href="luckhttp://www.infinitypages.com/research/verticalcentereddiv.htm">luckhttp://www.infinitypages.com/resear ... reddiv.htm</a><!-- m --> can easily be applied to an <img> rather than the <div> that I used in my example...Thank you! Thats exactly what I was going for!
BrianYou bet. I'm happy to help...