css透视属性不适用于Firefox

时间:2018-05-02 07:00:54

标签: html css firefox browser css-transforms

我正在尝试用css制作书籍封面列表。这是我的HTML:

<div class="books">
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
</div>

这是我最相关的CSS:

.csstransforms3d  .books {
  -moz-perspective: 100px;
  -moz-transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.csstransforms3d  .book {
  position: relative;
  -moz-transform: rotateY(-3deg);
  outline: 1px solid transparent; 
  -webkit-box-shadow: none;
          box-shadow: none;
  -webkit-transition: -webkit-transform ease-in-out .5s;
  transition: -webkit-transform ease-in-out .5s;
  -o-transition: transform ease-in-out .5s;
  transition: transform ease-in-out .5s;
  transition: transform ease-in-out .5s, -webkit-transform ease-in-out .5s;
}

这适用于chrome,但firefox显示错误的视角。

我意识到在firefox中,如果我将一个元素移动到另一个位置,则透视会发生变化。

如果我为每本简单的书制作不同的容器,问题似乎消失了,虽然透视外观与chrome不同,我认为这个解决方案非常糟糕:

<div class="books">
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
</div>
<div class="books">
  <div class="book verde" ><img src="https://about.canva.com/wp-content/uploads/sites/3/2015/01/children_bookcover.png" /></div><br>
</div>

请在此处查看我的完整代码:https://jsfiddle.net/fyhh8v73/5/(只是一个容器)https://jsfiddle.net/rkejgkzy/3/(每本书的容器)

0 个答案:

没有答案