谁能告诉我如何在不使用 Z-index
或 Z-order
的情况下在另一张图片上添加一张图片?
最佳答案
如果不确切知道您想要实现什么,很难正确回答,z-index 可能不是您真正需要的。例如,以下将起作用:
<div id="container">
<img src="img1.jpg" id="img1" />
<img src="img2.jpg" id="img2" />
</div>
#container {
position:relative;
}
#img2 {
position: absolute;
left: 50px;
top: 50px;
}
还有你是否使用<img>
标签或 background-images
取决于图像的语义值,即它们是页面的展示内容还是实际内容?
关于HTML 图像覆盖图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1074914/