<div class="wrapper">
<div class="parent">
<div class="child">
...
</div>
</div>
</div>
CSS:
.wrapper {
position: relative;
z-index: 0;
}
.child {
position: relative;
z-index: -1;
}
如何让父元素出现在子元素上方
最新推荐文章于 2023-04-15 10:58:28 发布
本文介绍了一种使用CSS进行元素定位的方法,通过设置不同层级的`z-index`值来实现特定的视觉效果。通过对`.wrapper`和`.child`两个类的相对定位属性调整,可以灵活控制页面元素的堆叠顺序。
1661

被折叠的 条评论
为什么被折叠?



