Rotate image around center css3

anthonytherockjohnson picture anthonytherockjohnson · Apr 7, 2014 · Viewed 67.2k times · Source

I'm trying to spin a world around its center - but cant seem to rotate it the correct way (around its own center axis)

Its hard to explain so I made a demo:

Thanks for the help (working help will be credited in the final experiment)

Answer

Fabrizio Calderan picture Fabrizio Calderan · Apr 7, 2014

you need to set the size of the element and specify the transform-origin property

-webkit-transform-origin: 50% 50%;
-moz-transform-origin: 50% 50%;
-o-transform-origin: 50% 50%;
transform-origin: 50% 50%;
width: 256px;
height: 256px;

Example fiddle : http://jsfiddle.net/RbXRM/3/