css parent元素出现在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.

http://jsbin.com/ovafo / edit

编辑:我无法在子级上设置负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.

http://jsbin.com/omazi/edit