Bootstrap Tutorial - Hover to rotate icon








The following code shows how to hover to rotate icon.

Example

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css"
  href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css">
<style type='text/css'>
.widgetbox {<!--  ww w  .ja va2 s.  c  o  m-->
  width: 250px;
  height: 250px;
  background-color: black;
  color: white;
  text-align: center;
}

.widgetbox [class*="icon-"] {
  display: block;
  transition-property: transform, color;
  transition-duration: 0.8s;
  -webkit-transition-property: -webkit-transform, color;
  -webkit-transition-duration: 0.8s;
  -ms-transition-property: -ms-transform, color;
  -ms-transition-duration: 0.8s;
}

.widgetbox:hover [class*="icon-"] {
  color: #24a159 !important;
  transform: rotate(360deg);
  -webkit-transform: rotate(360deg);
  -ms-transform: rotate(360deg);
}
</style>
</head>
<body>
  <div class="widgetbox">
    <br>
    <br>
    <div class="icon-calendar icon-large"></div>
    <h5>Add an event</h5>
  </div>
</body>
</html>

Click to view the demo