Effect How to - Hover to rotate








Question

We would like to know how to hover to rotate.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.5.2.js'></script>
<style type='text/css'>
.icon {<!--   ww w.  j a  v a  2s .  com-->
  -webkit-transition: all 400ms;
  -moz-transition: all 400ms;
  -o-transition: all 400ms;
  transition: all 400ms;
  display: block;
  width: 100px;
  height: 100px;
  background-color: red
}

.icon:hover {
  -webkit-transform: rotate(-90deg);
}
</style>
</head>
<body>
  <div class="icon"></div>
</body>
</html>

The code above is rendered as follows: