我正在使用css创建一张翻转卡片,当用户悬停/点击卡片时,它会翻转以显示背面的内容。这适用于除IE9之外的所有浏览器。
li {
list-style-type: none;
}
.info-card {
float: left;
margin: 2% 1% 0% 1%;
padding: 5% 0% 5% 0%;
position: relative;
-webkit-perspective: 600px;
-ms-perspective: 600px;
-moz-perspective: 600px;
}
.info-card:hover .back {
-webkit-transform: rotateY(0deg);
-moz-transform: rotateY(0deg);
-ms-transform: rotateY(0deg);
}
.info-card:hover .front {
-webkit-transform: rotateY(180deg);
-moz-transform: rotatey(180deg);
-ms-transform: rotatey(180deg);
}
.front,
.back {
transition: -webkit-transform 1s;
-moz-transition: 1s;
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
-ms-transition: 1s;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
}
.front {
background-color: #fff;
overflow: hidden;
width: 364px;
height: 300px;
position: absolute;
opacity: .5;
}
.front h3 {
text-decoration: underline;
padding: 32px;
font-size: 32px;
text-align: left;
color: #6633cc;
line-height: 38px;
}
.back {
background-color: #6633cc;
width: 364px;
height: 300px;
-webkit-transform: rotateY(-180deg);
-moz-transform: rotateY(-180deg);
-ms-transform: rotateY(-180deg);
}
.back p {
color: #fff;
padding: 20px 0px 0px 20px;
font-size: 14px;
}
.back h6 {
font-weight: 200;
font-family: arial;
font-size: 22px;
color: #fff;
position: absolute;
text-align: left;
padding: 0px 20px 30px 20px;
bottom: 0;
}
.back h6 a {
color: #fff;
text-decoration: underline;
}
我正在尝试使用css hack,但是在用户将鼠标悬停在前面div之前无法隐藏它:
@media screen and (min-width:0\0) {
.back {
backface-visibility: hidden;<--DOESN'T WORK IN IE9
}
.front:hover {
display: none;
}
}
我认为IE9不支持css的3d透视功能,因此卡片很可能只能在悬停时显示/隐藏卡片的背面。
JSFIDDLE:https://jsfiddle.net/uetno72t/4/