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 下應該是沒問題的(不過我現在只有 windows 10 的 IE Edge,低版本我沒辦法測試)http://codepen.io/nightire/pen/azggOP
需要注意的是 vendor prefix 的事情,我這個 Demo 里是有用 autoprefixer 的。
回答3:寫css3的屬性的時候,建議把前綴寫全了,支持的情況比較好。
-webkit-
-ms-
-moz-
相關文章:
1. javascript - vue-cli創建的項目,少一些步驟,對項目有影響嗎?2. 在mac下出現了兩個docker環境3. android - Python代碼轉為java代碼?4. 如何解決Centos下Docker服務啟動無響應,且輸入docker命令無響應?5. css3 實現一個線性漸變出現的問題?6. angular.js - angular內容過長展開收起效果7. css3 - css怎么實現圖片環繞的效果8. javascript - 一個是數組,一個是對象,怎么進行比較去重?9. css - div外層有一圈白色10. css - vue.js的vue單文件組件style中的scoped屬性無效
