【问题标题】:Images/CSS Transform not loading in Safari图片/CSS 转换未在 Safari 中加载
【发布时间】:2014-08-25 10:42:46
【问题描述】:

我在引导框架内使用了一些(看似)基本的 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);
}

【问题讨论】:

    标签: css twitter-bootstrap safari transform


    【解决方案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);
    }
    

    【讨论】:

      【解决方案2】:

      尝试添加

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

      【讨论】:

      • 我把它拍了进去,没有看到任何变化:(
      猜你喜欢
      • 1970-01-01
      • 2014-11-09
      • 1970-01-01
      • 2023-01-26
      • 2017-07-05
      • 1970-01-01
      • 1970-01-01
      • 2016-07-26
      • 2019-01-09
      相关资源
      最近更新 更多