FireFox Backface无法正常工作

时间:2014-05-03 17:02:32

标签: css css3 compatibility

我将背面可见性属性添加到卡的正面但在FireFox中它仍然显示卡的背面。见到这里:http://jsfiddle.net/AZSLB/

这是我的css:

   .flip {
    -webkit-perspective: 800;
    -moz-perspective: 800;
    -ms-perspective: 800;
    perspective: 800;
    position: relative;
}

.flip .card.flipped {
    -webkit-transform: rotatey(-180deg);
    -moz-transform: rotatey(-180deg);
    -ms-transform: rotatey(-180deg);
    -o-transform: rotatey(-180deg);
    transform: rotatey(-180deg);
}

.flip .card {
    width: 100%;
    height: 100%;

    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    transform-style: preserve-3d;

    -webkit-transition: 0.5s;
    -moz-transition: 0.5s;
    -ms-transition: 0.5s;
    -o-transition: 0.5s;
    transition: 0.5s;
}

.flip .card .face {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 2;
    text-align: center;

    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flip .card .front {
    position: absolute;
    z-index: 1;
    color: white;
    cursor: pointer;
}

.flip .card .back {
    -webkit-transform: rotatey(-180deg);
    background: #FFF url("<?php echo $dirUrl; ?>/assets/img/photo-bg.jpg");
    color: #222;
    cursor: pointer;
}

.flip .card .back p {
    font-size: 15px;
    padding: 10px 20px;

    position: absolute;
    height: auto;
    width: auto;
    top: 50%;
    left: 0;
    -webkit-transform: translate(0%, -50%);
    -moz-transform: translate(0%, -50%);
    -ms-transform: translate(0%, -50%);
    -o-transform: translate(0%, -50%);
    transform: translate(0%, -50%);
}

有什么想法吗?谢谢!

2 个答案:

答案 0 :(得分:2)

这种风格

.flip .card .back {
    -webkit-transform: rotatey(-180deg);
    background: #FFF url("<?php echo $dirUrl; ?>/assets/img/photo-bg.jpg");
    color: #222;
    cursor: pointer;
}

缺少未加前缀的转换

答案 1 :(得分:1)

尝试将“z-index:2”添加到背面div,如下所示:

.flip .card .back {
-webkit-transform: rotatey(-180deg);
background: #FFF url("<?php echo $dirUrl; ?>/assets/img/photo-bg.jpg");
color: #222;
cursor: pointer;
z-index: 2;
}

这可以确保“卡片”的背面位于正面的顶部。