我有一个小问题,这是我的代码。
img {
image-rendering: pixelated;
}
div.fight {
background: url("https://i.imgur.com/yM1ts8x.png");
background-size: contain;
width: 600px;
height: 300px;
position: relative;
}
div.fight img.player {
position: absolute;
bottom: 2%;
left: 4%;
height: 64px;
width: 64px;
}
<div class="fight">
<img src="https://i.imgur.com/VJhdtWy.png" class="player">
</div>
正如您在
img
中所看到的,我设置了应用程序中的所有图像都呈现为像素化。问题在于,当我设置background
时,我无法强制其成为像素化。有没有办法将
div.fight
的background
强制呈现为像素化?谢谢,祝您愉快。 :)