如何在HTML的
<img>
上重复使用1px x 1px的CSS背景图像?
http://jsfiddle.net/hjv74tdw/1/
我发现CSS在其他包含元素上显示div背景图像,但似乎需要一个额外的div。理想情况下,我希望根本不使用div,但根据CSS背景图像覆盖HTML img,这并不是真正可能的,至少对于100%宽度响应式方案而言。.test {
background: url(http://placehold.it/1/1) repeat;
position: relative;
z-index: 100;
width: 200px;
}
.test img {
width: 100%;
display: block;
position: absolute;
z-index: 50;
}
<div class="test">
<img src="http://lorempixel.com/400/400">
</div>