图像/ CSS转换未在Safari中加载

时间:2014-08-25 01:08:00

标签: css css3 twitter-bootstrap safari transform

我在引导程序框架中使用了一些(貌似)基本的CSS,并且出于某种原因,一旦我将代码放入引导程序,它就开始出现并且不显示图像或转换。

如果您在Chrome / FF /(甚至是IE)上转到here,您可以看到图片在鼠标悬停时加载和转换。如果你把它加载到Safari上,虽然它只是坐在那里,只显示应该是卡的背面。

我已经把头发弄了几个小时,任何建议都会非常感激!

谢谢:)

我的代码是:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/dickshit.css">
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>

<div class="row">
    <div class="col-md-6 col-md-offset-3">

<div id="f2_container">
<div id="f2_card" class="shadow">
  <div class="front face">
    <img src="/cardbacks/default.png" height="359" width="241"/>
  </div>
  <div class="back face center">
    <p>This is nice for exposing more information about an image.</p>
    <p>Any content can go here.</p>
        </div>
</div>
</div>
    </div></div>


    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

我的CSS是:

.face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}
.face.back {
  display: block;
  transform: rotateY(180deg);
  box-sizing: border-box;
  border-radius: 10px;
  padding: 10px;
  color: white;
  text-align: center;
  background-color: #aaa;
}


#f1_container {
  position: relative;
  float: left;
  margin: 10px 20px 10px  auto;
  width: 241px;
  height: 359px;
  z-index: 1;
}
#f1_container {
  perspective: 1000;
}
#f1_card {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: all 1.0s linear;
}
#f1_container:hover #f1_card {
  transform: rotateY(180deg);
}

#f2_container {
  position: relative;
  float: left;
  margin: 10px 20px 10px auto;
  width: 241px;
  height: 359px;
  z-index: 1;
}
#f2_container {
  perspective: 1000;
}
#f2_card {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: all 1.0s linear;
}
#f2_container:hover #f2_card {
  transform: rotateY(180deg);
}

2 个答案:

答案 0 :(得分:1)

您正在使用Safari“不支持”的一些CSS。您需要做的是解决问题的方法是在其中一些问题面前添加-webkit-(如下面链接的W3schools页面中所述):

为这些样式添加额外的代码后,结果在Safari中看起来也很好(我在Safari 5.1.7中测试过),CSS将是这样的:

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.face.back {
    display: block;
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    box-sizing: border-box;
    border-radius: 10px;
    padding: 10px;
    color: white;
    text-align: center;
    background-color: #aaa;
}
#f1_container {
    position: relative;
    float: left;
    margin: 10px 20px 10px auto;
    width: 241px;
    height: 359px;
    z-index: 1;
}
#f1_container {
    perspective: 1000px;
    -webkit-perspective:1000px;
}
#f1_card {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: all 1.0s linear;
    -webkit-transition: all 1.0s linear;
}
#f1_container:hover #f1_card {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
}
#f2_container {
    position: relative;
    float: left;
    margin: 10px 20px 10px auto;
    width: 241px;
    height: 359px;
    z-index: 1;
}
#f2_container {
    perspective: 1000px;
    -webkit-perspective: 1000px;
}
#f2_card {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: all 1.0s linear;
    -webkit-transition: all 1.0s linear;
}
#f2_container:hover #f2_card {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

答案 1 :(得分:0)

尝试添加

.face {-webkit-backface-visibility: hidden; backface-visibility: hidden;}