Image scaling causes poor quality in firefox/internet explorer but not chrome

前端 未结 10 1751
一个人的身影
一个人的身影 2020-11-27 03:44

See http://jsfiddle.net/aJ333/1/ in Chrome and then in either Firefox or Internet Explorer. The image is originally 120px, and I\'m scaling down to 28px, but it looks bad pr

10条回答
  •  眼角桃花
    2020-11-27 04:22

    Late answer but this works:

    /* applies to GIF and PNG images; avoids blurry edges */
    img[src$=".gif"], img[src$=".png"] {
        image-rendering: -moz-crisp-edges;         /* Firefox */
        image-rendering:   -o-crisp-edges;         /* Opera */
        image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor;  /* IE (non-standard property) */
    }
    

    https://developer.mozilla.org/en/docs/Web/CSS/image-rendering

    Here is another link as well which talks about browser support:

    https://css-tricks.com/almanac/properties/i/image-rendering/

提交回复
热议问题