IE浏览器中的图片呈现锯齿状。

12

我已经将png图像上传到网站上,在Firefox,Chrome和Safari中看起来完美,但在IE中看起来很糟糕。我从Photoshop中保存了这些文件,它们具有图像大小下的一个功能,可以让您选择以下选项之一作为图像: bicubic automatic、bicubic sharper、bicubic smoother、bicubic、bilinear和nearest neighbor。这些选项中的任何一个会有帮助吗?

<ul class="social">
  <li><a target="_blank" href="https://plus.google.com/+ToadhallcottagesCoUk/posts"><img onmouseout=this.src='/images/googleplusgrey-flat.png' onmouseover=this.src='/images/googleplus-flat.png' src="/images/googleplusgrey-flat.png" width="38" height="38" alt="Toad Hall Cottages Google Plus Page"</a></li>
  <li><a target="_blank" href="http://www.twitter.com/thcottages"><img onmouseout=this.src='/images/twittergrey-flat.png' onmouseover=this.src='/images/twitter-flat.png' src="/images/twittergrey-flat.png" width="38" height="38" alt="Toad Hall Cottages on Twitter" /></a></li>
  <li><a target="_blank" href="http://www.facebook.com/holidaycottages"><img <img onmouseout=this.src='/images/facebookgrey-flat.png' onmouseover=this.src='/images/facebook-flat.png'  src="/images/facebookgrey-flat.png" width="38" height="38" alt="Toad Hall Cottages Facebook page"/></a></li>
  <li><a target="_blank" href="http://www.pinterest.com/thcottages/"><img <img onmouseout=this.src='/images/pinterestgrey-flat.png' onmouseover=this.src='/images/pinterest-flat.png' src="/images/pinterestgrey-flat.png" width="38" height="38" alt="Toad Hall Cottages Facebook page" /></a></li>
</ul>

CSS:

img.icon { 
  vertical-align: middle; 
  margin-right: 8px; 
  margin-left: 2px;
  image-rendering:optimizeSpeed;             /* Legal fallback */
  image-rendering:-moz-crisp-edges;          /* Firefox        */
  image-rendering:-o-crisp-edges;            /* Opera          */
  image-rendering:-webkit-optimize-contrast; /* Safari         */
}

2
糟糕的浏览器会糟糕地渲染页面......你介意分享你的CSS和HTML,这样我们就可以帮忙!! :) - NoobEditor
4
您应该按照网站所需的尺寸将图片保存在服务器上 - 例如,如果您的页眉以800x100像素显示,则您的图像也应该恰好为800x100像素。 - Njol
我已经上传了CSS和HTML。 - totneschap
为什么编辑@NoobEditor,它布局不良吗? - totneschap
@totneschap:不会,因为任何未来访问此问题的人都可能会发现一个格式更好的问题,获得更好的体验!! :) - NoobEditor
显示剩余7条评论
1个回答

6
旧的IE方法是:
-ms-interpolation-mode: bicubic;

这篇文档记录不够详细。


1
这个问题可以通过jQuery插件解决:http://stackoverflow.com/questions/34965904/ie-thumbnail-pixelation-when-high-resolution-image-is-set-to-small-size - Anton Lyhin
5
如果OP要求使用jQuery解决方案,想象一下。 - daniel aagentah
这不是默认插值吗?我在IE 11中看不出任何区别。 - BarryCap
嗨@BarryCap,不,这个功能只在IE7和8中可用,对于IE9及以上版本来说是不必要的。 - Barney

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接