我有三个图像img1.png,img2.png,img3.png高度分别为600px,400px和200px。我想将这些图像置于相同的位置,如后面的img1.png,中间的img2.png和前面的img3.png。我尝试使用CSS位置属性,但不工作。我已经将图像作为三个div的背景:将三个背景图像放在相同的位置
<div id="clouds1"></div>
<div id="clouds2"></div>
<div id="clouds3"></div>
<style>
#clouds1
{
background:url('images/img1.png');
height:600px;
position:absolute;
z-index:1;
}
#clouds2
{
background:url('images/img2.png');
height:400px;
position:relative;
z-index:8;
}
#clouds3
{
background:url('images/img3.png');
height:200px;
position:relative;
z-index:99;
}
</style>
我们如何用css位置属性或使用其他方法来做到这一点。请帮忙。谢谢
你能证明你有试过吗?使用ATTR? – guradio
问题更新与位置attr ..请检查 – shfkktm
您的div在您的CSS使用类的ID?尝试使用绝对所有你的风格 – guradio