![CSS设置宽高后图片变模糊的解决办法](https://web-assets.taohuila.cn/wp-content/uploads/2023/12/20231205234750437-683cb7f0acf28ca0ad69bdfa95930a5f_1045291030-1024x509.png)
写博客的时候偶尔发现,明明图片清晰度足够,但是通过CSS设置宽度和高度后图片就变模糊了,使用如下CSS设置可解决这个问题。
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) */
}
img {
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) */
}
© 版权声明
THE END
暂无评论内容