css3中的3D翻轉問題
問題描述
<p class='container'> <p class='side'><p class='front'> <!-- 正面 --></p><p class='back'> <!-- 反面 --></p></p>
.container { perspective: 1000; }.container:hover .side{ transform: rotateY(180deg);}.container, .front, .back { width: 320px; height: 480px;}.side { transition: 0.6s; transform-style: preserve-3d; /*讓其子元素有3D翻轉的效果。*/ position: relative;}.front, .back { backface-visibility: hidden; /*將反轉了180度的隱藏*/ -ms-backface-visibility: hidden; position: absolute;}.front { background-color: red;}.back { transform: rotateY(180deg); background-color: blue;}
比較郁悶的是,在其他瀏覽器都能正常顯示效果,但是IE不行,backface-visibility: hidden;這句單獨在IE下測試是可以用的,但是這里放一起就出問題了,在IE下它翻轉180度后并沒有隱藏,這是為什么,哪位大神幫我看看,先謝過啦。
問題解答
回答1:http://caniuse.com/#search=backface-visibilityPartial support in IE refers to not supporting the transform-style: preserve-3d property. This prevents nesting 3D transformed elements.
ie edge支持ie11 ie10 Partial supportie9- 不支持
回答2:不知道你的 IE 目標版本是多少,這是我以前寫給別人看的 Demo,在 IE 下應該是沒問題的(不過我現(xiàn)在只有 windows 10 的 IE Edge,低版本我沒辦法測試)http://codepen.io/nightire/pen/azggOP
需要注意的是 vendor prefix 的事情,我這個 Demo 里是有用 autoprefixer 的。
回答3:寫css3的屬性的時候,建議把前綴寫全了,支持的情況比較好。
-webkit-
-ms-
-moz-
相關文章:
1. javascript - node.js服務端渲染解疑2. javascript - 求助關于js正則問題3. html5 - 如何解決bootstrap打開模態(tài)modal窗口引起頁面抖動?4. javascript - 求助這種功能有什么好點的插件?5. objective-c - ios百度地圖定位問題6. 微信開放平臺 - Android調用微信分享不顯示7. html - css 如何添加這種邊框?8. html5 - rudy編譯sass的時候有中文報錯9. javascript - 關于定時器 與 防止連續(xù)點擊 問題10. 為何 localStorage、sessionStorage 屬于html5的范疇,但是為何 IE8卻支持?
