CSS Z-index 不重叠

CSS Z-index not overlapping

所以我试图用 CSS 自定义一个网站,但我不能重叠 this image under this element。 代码:

body#bodyDefault > form > div > table > tbody::after {
    pointer-events: none;
    content:' ';
    position: absolute;
    right: 0;
    top: 0;
    z-index: 20;
    background-image: url('');
    height: 200px;
    width: 200px;
    background-size: 200px;
}
body#bodyDefault > form > div > table > tbody > tr:nth-child(2) {
    z-index: 50;
}

我试图通过将图像隐藏在 tr 元素下来剪切图像的多余部分。

使用position: absolute/relative;body#bodyDefault > form > div > table > tbody > tr:nth-child(2)

为什么?

如果没有 position: absolute/relative;

z-index 将不起作用

例如:

body#bodyDefault > form > div > table > tbody > tr:nth-child(2) {
    z-index: 50;
    position: absolute;// or relative
}