旋转图标在codepen中工作,但不在浏览器中工作

时间:2014-01-16 00:12:02

标签: html5 icons css3 animated

我正在玩代码来嵌入在悬停时旋转的社交网络图标。我正在为一个项目调整它们,它在this pen中工作正常。但是当我将代码复制到括号中时,无论何时页面加载,图标都不会出现,直到您将鼠标悬停在方块上。任何人都知道我哪里出错了?

HTML

<section>
  <ul id='services'>
    <li>
      <div class='entypo-facebook'></div>
    </li>
    <li>
      <div class='entypo-twitter'></div>
    </li>
    <li>
      <div class='entypo-gplus'></div>
    </li>
    <li>
      <div class='entypo-linkedin'></div>
    </li>
  </ul>
</section>

CSS

@import url(http://weloveiconfonts.com/api/?family=entypo);
/* entypo */
[class*="entypo-"]:before {
  font-family: 'entypo', sans-serif;
}

html, body {
  margin: 0;
  background-color: #ECF0F1;
}

section #services {
  text-align: center;
  transform: translatez(0);
}


section #services li {
  width: 40px;
  height: 40px;
  display: inline-block;
  margin: 20px;
  list-style: none;
}

section #services li div {
  width: 40px;
  height: 40px;
  color: #ECF0F1;
  font-size: 1.2em;
  text-align: center;
  line-height: 40px;
  background-color: #cccccc;
  transition: all 1s ease;
}

section #services li div:hover {
  transform: rotate(360deg);
    -ms-transform: rotate(360deg); /* IE 9 */
    -webkit-transform: rotate(360deg); /* Safari and Chrome */
    border-radius: 100px;
    -webkit-border-radius: 100px;
    -moz-border-radius: 100px;
    background-color: #303030;
}

1 个答案:

答案 0 :(得分:0)

您必须在-webkit-媒体资源中设置-moz- transform等前缀。

SEE DEMO

section #services li div:hover {
  -moz-transform: rotate(360deg);
  -webkit-transform: rotate(360deg);
  transform: rotate(360deg);
  border-radius: 100px;
}