Z-Index Relative or Absolute?

前端 未结 4 674
野性不改
野性不改 2020-11-27 02:30

I\'m trying to find an answer to the following question:

Is an element\'s z-index style its absolute stack order, or its stack order relative to its parent?

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 03:11

    Afaik, z-index doesn't work unless that element is set to position: relative; If that same element had a child with position: relative; and the z-index was set higher, the child would show on top of its parent.

    So it has elements of both 'absolute' and 'relative' stack order as you phrased it.

    All browsers pretty much handle it the same, I think.

提交回复
热议问题