问题
I'm trying to create a flip card animation with CSS. It works well on Firefox, Chrome, Opera, Safari but I have a problem with Internet Explorer (again)...
Look at demo I made : Text problem with Internet Explorer
That's OK in Firefox, Chrome, Opera and Safari !
But my text is inverted with Internet Explorer... Please, tell me what's wrong in my code ?
CSS :
<style>
.flip-container {
-webkit-perspective : 680;
-ms-perspective: 680;
-moz-perspective: 680;
-o-perspective: 680;
perspective: 680;
}
.flip-container:hover .flipper, .flip-container.hover .flipper {
-webkit-transform:rotateY(180deg);
-moz-transform:rotateY(180deg);
-ms-transform:rotateY(180deg);
-o-transform:rotateY(180deg);
transform: rotateY(180deg);
}
.flip-container, .front .back {
width:480px;
height:340px;
}
.flipper {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transition: 2.0s;
-moz-transition: 2.0s;
-ms-transition: 2.0s;
-o-transition: 2.0s;
transition: 2.0s;
position: relative;
}
.front, .back {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index: 2;
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg); }
.back {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
</style>
回答1:
I added an update for latest Internet Explorer versions. It works for each modern desktop browser.
I correct rotation values :
Initial : Front = 0° Back = -180°
Hover : Front = 180° Back = 0°
This code still need to be updated to be compatible with IE6 IE7 IE8 :
<style>
.flip-container {
-webkit-perspective : 680;
-moz-perspective: 680;
-ms-perspective: 680;
-o-perspective: 680;
perspective: 680;
}
/* For Internet Explorer */
.flip-container:hover .back, .flip-container.hover .back {
-webkit-transform:rotateY(0deg);
-moz-transform:rotateY(0deg);
-ms-transform:rotateY(0deg);
-o-transform:rotateY(0deg);
transform: rotateY(0deg);
}
/* For Internet Explorer */
.flip-container:hover .front, .flip-container.hover .front {
-webkit-transform:rotateY(180deg);
-moz-transform:rotateY(180deg);
-ms-transform:rotateY(180deg);
-o-transform:rotateY(180deg);
transform: rotateY(180deg);
}
.flip-container, .front .back {
width:480px;
height:340px;
}
.flipper {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
position: relative;
}
.front, .back {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 2.0s;
-moz-transition: 2.0s;
-ms-transition: 2.0s;
-o-transition: 2.0s;
transition: 2.0s;
position: absolute;
top: 0;
left: 0;
}
.front {
z-index:2;
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
-o-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.back {
z-index:1;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
-o-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
</style>
来源:https://stackoverflow.com/questions/26830170/creating-flip-card-with-css