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

前端 未结 10 1740
一个人的身影
一个人的身影 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:13

    This is possible! At least now that css transforms have good support:

    You need to use a CSS transform to scale the image - the trick is not just to use a scale(), but also to apply a very small rotation. This triggers IE to use a smoother interpolation of the image:

    img {
        /* double desired size */
        width: 56px; 
        height: 56px;
    
        /* margins to reduce layout size to match the transformed size */ 
        margin: -14px -14px -14px -14px; 
    
        /* transform to scale with smooth interpolation: */
        transform: scale(0.5) rotate(0.1deg);
    }
    

提交回复
热议问题