在开发中遇到盒子中使用背景图,背景图中有文字,uniapp小程序要适配不同机型,背景图放大或者缩小的时候,会出现模糊的现象
解决方法:
.list-item {
background-image: url('../../static/quanse.png');
background-position: 0% 0%;
background-size: 686rpx 254rpx;
width: 686rpx;
height: 254rpx;
border-radius: 32rpx;
background-repeat: no-repeat;
image-rendering:-moz-crisp-edges;
image-rendering:-o-crisp-edges;
image-rendering:-webkit-optimize-contrast;
image-rendering: crisp-edges;
-ms-interpolation-mode:nearest-neighbor;
}
此方法只在uniapp小程序中亲测过,若其他小程序或者pc端使用无效,请参考其他方法。
如有其他解决方法欢迎留言交流,互相学习,前端小萌新,勿喷