gpt4 book ai didi

html - 将位置从静态更改为相对位置会使绝对跨度消失

转载 作者:太空宇宙 更新时间:2023-11-04 02:30:11 24 4
gpt4 key购买 nike

我的页面中有两个不同的 span,一个是 absolute 位置,另一个是 relative 位置。 Plunker代码是here .

现在,我看到绝对定位的 div 被完全隐藏了,

enter image description here

但是当我将我的 relative-ly positioned span 更改为 static 位置时,absolute 位置 span 出现在顶部,

enter image description here

css-tricks说,

If you set position: relative; on an element but no other positioning attributes (top, left, bottom or right), it will no effect on it's positioning at all, it will be exactly as it would be if you left it as position: static;

如我所见,relativestatic 都不相同。 relativestatic 位置如何影响顶层显示的内容?

最佳答案

你有 absolute div 出现在 View 中,它只是你在相对类的跨度之后写了绝对类的跨度,所以绿色 block 在黑色 block 之上。如果你给 z-index:2; 绝对类那么你可以看到绝对类跨度

关于html - 将位置从静态更改为相对位置会使绝对跨度消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36666695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com