简体   繁体   中英

Spinning icons work in codepen, but not in browser

I'm playing around with code to embed social network icons that rotate on hover. I am adjusting them for a project, and it works fine in this pen . But when I copy the code into Brackets, whenever the page loads, the icons don't appear until you hover over the square. Anyone have any idea where I'm after going wrong?

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;
}

You have to set the prefix like -webkit- -moz- and so on in your transform property.

SEE DEMO

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM