【问题标题】:Spinning icons work in codepen, but not in browser旋转图标在 codepen 中有效,但在浏览器中无效
【发布时间】:2014-01-16 00:12:02
【问题描述】:

我正在使用代码来嵌入在悬停时旋转的社交网络图标。我正在为一个项目调整它们,它在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;
}

【问题讨论】:

    标签: html icons css animated


    【解决方案1】:

    您必须在 transform 属性中设置前缀,例如 -webkit- -moz- 等等。

    SEE DEMO

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

    【讨论】:

    • 我已经添加了这些前缀,谢谢,但是直到将灰色方块悬停在上面时字体仍然无法加载。
    • 我有,它在第二个 codepen 链接中,当复制到文件中并在浏览器中查看时,它不会加载图标,直到它们被悬停在上面
    • 嗯,奇怪,也许它必须在线才能工作!谢谢,我会尝试上传。
    猜你喜欢
    • 1970-01-01
    • 2020-08-22
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多