我的页面中有两个不同的 span,一个是 absolute
位置,另一个是 relative
位置。 Plunker代码是here .
现在,我看到绝对定位的 div 被完全隐藏了,
但是当我将我的 relative
-ly positioned span 更改为 static
位置时,absolute
位置 span 出现在顶部,
If you set
position: relative
; on an element but no other positioning attributes (top
,left
,bottom
orright
), it will no effect on it's positioning at all, it will be exactly as it would be if you left it asposition: static;
如我所见,relative
和 static
都不相同。 relative
和 static
位置如何影响顶层显示的内容?
最佳答案
你有 absolute div 出现在 View 中,它只是你在相对类的跨度之后写了绝对类的跨度,所以绿色 block 在黑色 block 之上。如果你给 z-index:2;
绝对类那么你可以看到绝对类跨度
关于html - 将位置从静态更改为相对位置会使绝对跨度消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36666695/