WebKit: Is there any css trick to bring elements to front without scaling it?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 09:13:13

问题


From the picture, I use rotate3d() to the red rectangle so half of it is in front of black rectangle and the other is behind.

I want black rectangle to be front of red rectangle so I have to use translateZ() so it become

The problem is that I want black rectangle to be front without scaling it. I want black rectangle to still be the same size. Is there any trick? I tried z-index but it didn't work. I guess it because I use rotate3d().

Thanks in advance.


回答1:


I do not have access to Safari at present to test it in, so I leave that to you (let me know if it works), but I believe the following should work.

Since browser interpretation of -webkit-perspective seems to be the problem as I noted in my answer to this question, remove it from #container and replace it with -webkit-transform: perspective(500) and then add the same thing (-webkit-transform: perspective(500)) to both #parent and #parent2 which is what I have done in this fiddle.

The issue seems to be that Safari does not apply a perspective to the #container when using -webkit-perspective whereas Chrome does. It seems to be a matter of interpretation of the spec, as I discussed in answering the other question.



来源:https://stackoverflow.com/questions/10623479/webkit-is-there-any-css-trick-to-bring-elements-to-front-without-scaling-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!