Weird behavior when rotating an element on hover
Given these two examples. Using Hover div { position: absolute; width: 150px; height: 40px; background: orange; left: 50%; top: var(--top); transition: transform 2s; transform: translateX(-50%); text-align: center; line-height: 40px; font-size: 1.2em; } div:hover { transform: translateX(-50%) rotate(var(--deg)); } div:nth-child(1) { --deg: 180deg; --top: 20%; } div:nth-child(2) { --deg: -180deg; --top: 40%; } div:nth-child(3) { --deg: 360deg; --top: 60%; } <div>180deg</div> <div>-180deg</div> <div>360deg</div> Using Animation div { position: absolute; width: 150px; height: 40px; background: