You might want to try using transform: rotate() and how in sven comment to change the prefix to "-moz-" not "-webkit-" because you are using mozilla animation.
Here is an example: http://jsfiddle.net/gVCWE/14/
.box{ width:50px; height:50px; background: yellow; border: 1px solid black; margin:100px; position: relative; float: left; -moz-animation: 3s ease 0s normal none infinite swing; -moz-transform-origin: center top; -webkit-animation:swing 3s infinite ease-in-out; -webkit-transform-origin:top; } @-moz-keyframes swing{ 0%{-moz-transform:rotate(-3deg)} 50%{-moz-transform:rotate(3deg)} 100%{-moz-transform:rotate(-3deg)} } @-webkit-keyframes swing{ 0%{-webkit-transform:rotate(-3deg)} 50%{-webkit-transform:rotate(3deg)} 100%{-webkit-transform:rotate(-3deg)} }
Also, the reason they have -moz-transform-origin: center top; , lies in the fact that it rotates around the top, so using left: -2px left: 200px makes no sense.
EDIT: new jsfiddle example: http://jsfiddle.net/gVCWE/20/
source share