I'm having trouble making an image of an X rotate 180 degrees when it's hovered over. Instead of rotating, the image just moves up and to the right.
What am I missing that's preventing this from looking like a smooth 180-degree spin?
.black {
background: #000;
width: 100%;
height: 400px;
}
.popup-close {
position: absolute;
top: 40px;
right: 40px;
}
#x-close:hover {
-webkit-transform: translate(50%, -50%) rotate(180deg);
transform: translate(50%, -50%) rotate(180deg);
}
<div class="black">
<a class="popup-close" data-popup-close="popup-1" href="#">
<img src="http://optimumwebdesigns.com/icons/delete-cross.png" alt="" height="40px" width="40px" id="x-close">
</a>
</div>