直到开发工具打开CSS时3D变换透视图才起作用

时间:2019-07-01 11:43:09

标签: html css

该问题仅出现在Firefox中,直到检查器打开,样式才会起作用。我认为这与透视图或变换样式有关,但我似乎无济于事

CodePen

.id-card {
  height: 100%;
  min-height: 300px;
  position: relative;
  -moz-perspective: 1000px;
  -webkit-perspective: 1000px;
  perspective: 1000px;
}
.id-card-inner {
  border-radius: 10px;
  box-shadow: 0px 5px 10px 0px #bababa;
  text-align: left;
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  -moz-transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;

}
.id-card:hover .id-card-inner {
  transform: rotateY(180deg);
}
.id-card-front, .id-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -moz-backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  padding: 25px;
}
.id-card-front {
  z-index: 1;
}
.id-card-back {
  background-color: #fff;
  transform: rotateY(180deg);
  z-index: 1;
  overflow-y: auto;
}
.id-card img {
  max-width: 200px;
  float: right;
}

Video

感谢您的帮助,谢谢!

1 个答案:

答案 0 :(得分:1)

height:300px用在.id-card

.id-card {
  /*height: 100%;*/
    height: 300px;
    min-height: 300px;
    position: relative;
    -moz-perspective: 1000px;
    -webkit-perspective: 1000px;
    perspective: 1000px;
    clear:both;
}

Check the updated codepen here