[SOLVED] how-to: center images and make them not stretch in IE8

Hello,

Client asked me to look into centering images horizontally and vertically inside the gallery. I made it work with CSS, but had an issue with landscape images stretching improperly in IE8.

Here's what I did to make them center (in css/gallery-css.php):

/* added these rules: */

#fullsize { line-height:<?php echo ((int) $styles['height'] - 6); ?>px; }
#image { text-align: center; height: 100%; }
#image img { max-height: 100%; vertical-align: middle; }

/* removed these rules: */

#image img { position:absolute; left:0; }

Here's what I did to fix the IE8 issue (in css/gallery-css.php):

#image img { width: auto; }

So essentially I just added width:auto; to the last selector and that made IE8 behave!

Comments

Sign In or Register to comment.