3D Transforms and Z-Index: Unraveling the Mystery
When utilizing webkit transforms in CSS, particularly via translate3d, inconsistencies can arise in the behavior of z-index, affecting the stack order of elements.
In your case, you employed translate3d to animate two overlapping divs off and back onto the screen. However, post-transformation, the divs lost their prescribed z-index priority.
This occurs because when you apply a 3D transform on the z-axis (i.e., translate3d's third parameter), the traditional 2D z-index mechanism no longer applies. In a 3D rendering plane, the hierarchy is determined by the z-value of each element, effectively overriding the z-index.
To rectify this, you have two options:
Additional Context:
Refer to the WebKit bug report (https://bugs.webkit.org/show_bug.cgi?id=61824) for further insights.
Target Browsers:
Both iPhone/iPad and Android browsers support webkit transitions, so you should see the issue resolved in these environments.
The above is the detailed content of How Do 3D Transforms Affect z-index Stacking Order?. For more information, please follow other related articles on the PHP Chinese website!