[英]Image not centering in IE8 when using max-width?
I have a table that contains an image, but for some reason I cannot get certain images to center correctly. 我有一个包含图像的表,但是由于某种原因,我无法使某些图像正确居中。 When I apply max-width:170px
the image resizes correctly, but it does not center. 当我应用max-width:170px
,图像会正确调整大小,但不会居中。 In every other browser (even IE7) everything looks good, but IE8 chokes. 在所有其他浏览器(甚至是IE7)中,一切看起来都不错,但IE8却令人窒息。 Here is the FIDDLE http://jsfiddle.net/5VT7e/ . 这是FIDDLE http://jsfiddle.net/5VT7e/ 。
Note: I created the fiddle in Chrome, but went to view it in IE8 and I guess JSFIDDLE doesn't work in IE8. 注意:我在Chrome中创建了小提琴,但是在IE8中查看了它,我想JSFIDDLE在IE8中不起作用。 None-the-less you can view all the code ;) 不过,您可以查看所有代码;)
Here's a screen shot of the problem: 这是问题的屏幕截图:
Problem: 问题:
Desired: 期望的:
Pretty much any image that max-width:170px
effects is shifted to the right. max-width:170px
效果的几乎所有图像都向右移动。
Thanks for having a look. 感谢您的浏览。
This answer provides two possible solutions: 该答案提供了两种可能的解决方案:
width: auto
on your images 设置width: auto
显示图像
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.