For example having 2 div's positioned absolute, one can put first div upon second by setting first div's z-index higher than second one's. Can we achieve such behaviour using translateZ() or translate3d?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
The answer now, 3 years after, is that you can. You need to use
transform-style: preserve-3d;
on the parent, but it's possible.Short answer: No. View demo which works as of time of posting
Longer answer: It's not supposed to, but sometimes, such as when one element has a transform when its sibling doesn't, some browsers don't handle the situation well, resulting in the z-index being ignored.
Generally, however, this is because the
transform
itself is applied, not because of thetranslateZ
. The solution in such a case it to give all relevant elementstransform: translate3d(0px, 0px, 0px)
or something similar which makes the browser render the elements more carefully