Boxes rotation animation

by rulokc

HTML

<div class="box a"></div>
<div class="box b"></div>

CSS

.box {
    width: 100px;
    height: 100px;
    position: absolute;
    left: 50px;
    top: 50px;
}
.box.a {
    background-color: #0f0;
}
.box.b {
    background-color: #f00;
    width: 50px;
    height: 50px;
    top: 75px;
    left: 75px;
}
.box:hover {
    -webkit-animation-duration: 1s;
    -webkit-animation-name: myrotation;
}
@-webkit-keyframes myrotation {
    from {
        -webkit-transform: rotate(0deg);
    }
    to {
        -webkit-transform: rotate(360deg);
    }
}