By default, transform-origin is 50% 50% what you need.
But you set the width to 0, and so it rotates around 0 in the horizontal direction.
You need to make your element as big as the contents, and also make the contents inside it.
In your example, just setting the inline-block element and removing width:0 almost fix it.
Gabriele petrioli
source share