如何实现图片居中并叠加的效果?

有abc三张png图片,如何让它们水平居中并叠加在一起?


梵蒂冈之花
浏览 385回答 1
1回答

繁星coding

先上图,不知道是不是你要的效果<head><style>.div1 {&nbsp; width: 100px;&nbsp; height: 100px;&nbsp; position: absolute;&nbsp; display: flex;&nbsp; justify-content: center;}.img1{&nbsp; position: relative;&nbsp; width: 70px;&nbsp; height: 70px;&nbsp; background: #f00;}.img2{&nbsp; position: relative;&nbsp; width: 50px;&nbsp; height: 50px;&nbsp; background: #0f0;}.img3{&nbsp; position: relative;&nbsp; width: 30px;&nbsp; height: 30px;&nbsp; background: #00f;}.img2 {&nbsp; position:&nbsp;}</style></head><body><div class="div1">&nbsp; <div class="img1"></div></div><div class="div1">&nbsp; <div class="img2"></div></div><div class="div1">&nbsp; <div class="img3"></div></div></body>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript