Posts

Showing posts from March, 2007

Vertical align image - Howto - The easist way!

Ref: http://www.webmasterworld.com/forum83/6588.htm Actually, it is not that difficult provided that you know the way of doing this. I know from varies web site that vertically align an image in the middle of the screen is very difficult. I agree and actually I have spent more than an hour of doing this. To make it short: it is tested in FF2, IE7. OK, let's go to the details. CSS file: body, html { font-family: Arial, Helvetica, sans-serif; font-size:12px; margin-top:0px; margin-left:0px; margin-right:0px; height:100%; /*This line is the most important one.*/ } HTML file: <table class="index" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> <tr><td align="center" valign="middle"><img src="your.jpg" /></td></tr> </table> That's it! As far as I know, the height=100% in CSS will set the whole to fit the