css parent元素出现在child上面 [英] css parent element to appear above child
本文介绍了css parent元素出现在child上面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个嵌套的css元素。我需要得到父元素在顶部,即在z轴上的子元素。只是设置z-index是不够的。我如何做到这一点?感谢。
I have 2 nested css elements. I need to get the parent to be on top, that is, above in z-axis, of the child element. Just setting z-index is not sufficient. How do I do this? Thanks.
编辑:我无法在子级上设置负z-index,将其设置在我实际的页面容器下页。这是唯一的方法吗?
I can't set a negative z-index on the child, that'll set it to below the page container on my actual page. Is this the only method?
Edit2:更新示例以设置位置:绝对;
Updated example to set both on position:absolute;
推荐答案
为子项设置一个负值 z-index
,并删除父项上设置的值。
Set a negative z-index
for the child, and remove the one set on the parent.
这篇关于css parent元素出现在child上面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文