开发者

css 3d transforms and zindex fighting

I have two <div> elements that overlap eachother, like:

 -------------
 |           |
 |     A     |
 |           |
 | 开发者_开发百科  ------------
 |   |          |
 |   |          |
 ----|     B    |
     |          |
     ------------

So I add B to the DOM after A. Inside div A I have some other html elements (images) that I apply css3d transforms to, however when I do this they also appear infront of div B, I always want div B to be above div A and all of its content. I tried setting the z-index property on both div elements but the 3d transformed items in A still render ontop of div B.

Any way to always make B appear infront of A and it's content?

Thanks Mark.


If you need an elements's z-index to work against 3d transformed divs, you have to style it with -webkit-transform: translateZ(0px);

Snippet on codepen -> http://codepen.io/mrmoje/pen/yLIul


It works: http://jsfiddle.net/qkLWH/1/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜