webkit-transform overwrites z-index ordering in Chrome 13
css, google-chrome, javascript, webkit
Solution
Solved it myself through trial and error. Thought I'd report back if someone else stumbles upon this problem. It shall still be noted that this problem did not occur before Chrome updated itself to Chrome 13 (13.0.782.107m).
The trick here seems to be to add a `translate3d` operation to the underlying `<div>` (`sq2`) element upon declaration (or atleast before animating `sq1`).
Otherwise, the `translate3d` operation on the overlying `<div>` (`sq1`) will cause rendering to ignore the `z-index` and place `sq1` below `sq2`. I'm guessing that this is because `sq1` is defined before `sq2` in the DOM, therefore `sq2` will be rendered above it.
So, the solution seems to be to put `translate3d` in the definition of the `<div>`:s (add it to both just to be clear):
HTML:
<div id="sq1" style="z-index:10; -webkit-transform: translate3d(0px, 0px, 0px);">
<div id="sq2" style="z-index:5; -webkit-transform: translate3d(0px, 0px, 0px);">
Problem
Update Sorry for failing to add the minor detail that we also layer a lot of `div` elements on top of each other with `z-index`. After working more with this problem, it seems that the `webkit-transform` actually messes with the `z-index` ordering, and that the actual problem is not related to the animations themselves. End update I am currently in a project where we develop an application which is quite heavy on CSS3 animations. We're animating a lot of `div` elements around with `-webkit-transform` and `-webkit-transition`. All is well, until today where all of the to-be-animated elements of the page disappeared. It seems that Google Chrome has updated from 12.xx to 13.0.782.107m and now, all of a sudden, CSS3 properties with `-webkit` prefixes has stopped working, and elements which have this property applied to them just doesn't show anymore. Removing the `-webkit-transform` property through the Chrome debugger makes the elements visible again. Has anyone else experienced the same issues, or know how to solve this problem? I might add that I've tried to remove just the `-webkit` prefixes (leaving just `transform`), which then shows the missing elements, but then that won't animate the elements at all, as the CSS3 property `transform` is not supported. I have also tried using `el.style.webkitTransform` and `el.style.WebkitTransform`, with no success. Will pass some example code to explain. The desired result of this is to move `sq1` away and reveal `sq2`. ``` HTML: <div id="sq1" style="z-index:10;"> <div id="sq2" style="z-index:5;"> JS /* fetch the element */ var el = document.getElementById("sq1"); /* apply CSS */ el.style["-webkit-transition"] = "-webkit-transform 500ms linear"; el.style["-webkit-transform"] = "translate3d(30px, 30px, 0px)"; ```