我在一个<div>
. 我希望图像相互叠加(对于使用不透明度的幻灯片)并在我的网站上保持中心位置。
为了使图像叠加,我将它们的位置设置为绝对 ( position: absolute;
)。但是,这与我集中图像的方法相冲突。为了使我的图像居中,我为图像提供了以下属性:margin: 0 auto; display: block;
当图像的位置设置为绝对时,这不起作用。我可以使用哪些其他方法使我的图像覆盖和/或集中图像。
<div>
<img id="SlideShow1" src="Images\image1.jpg" width="512" height="512">
<img id="SlideShow2" src="Images\image2.png" width="512" height="512">
<img id="SlideShow3" src="Images\image3.jpg" width="512" height="512">
</div>
img {
position: absolute;
margin: 0 auto;
display: block;
}