使位置的孩子:与其父母绝对重叠

问题描述 投票:0回答:1

我目前正在尝试一些动画并获得此结构:

https://jsfiddle.net/49qg3h1w/3/

<div style="position: relative; background: black; height: 100vh; width: 100vw;">
  <div style="position: absolute; z-index: -1;">
    <!-- Make this element overlap it's parents -->
    <div style="background-color: red; width: 20px; height: 20px; z-index: 2;">
    </div>
  </div>
</div>

我如何使红色元素或其子元素之一与其父元素重叠?

css
1个回答
0
投票

子级始终与父级重叠。

© www.soinside.com 2019 - 2024. All rights reserved.