css3中的3D翻转问题
PHP中文网
PHP中文网 2017-04-17 11:20:31
0
3
655
<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度后并没有隐藏,这是为什么,哪位大神帮我看看,先谢过啦。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
巴扎黑

http://caniuse.com/#search=backface-visibility
Partial support in IE refers to not supporting the transform-style: preserve-3d property. This prevents nesting 3D transformed elements.

ie edge支持
ie11 ie10 Partial support
ie9- 不支持

迷茫

I don’t know what your IE target version is. This is a demo I wrote for others before. It should be no problem under IE (but I only have IE Edge for Windows 10 now, and I can’t test the lower version) http://codepen.io/nightire/pen/azggOP

What needs to be noted is the vendor prefix. The autoprefixer is used in my demo.

Ty80

When writing CSS3 attributes, it is recommended to write all the prefixes for better support.

-webkit-

-ms-

-moz-

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template