I've got a PNG image icon with un-even sides (64px x 42px) and I'd like to create a circle border around it.
My html looks like this:
<span class="cat_circle">
<div class="cat_icon">
<img src="https://cdn.pbrd.co/images/GNK97WG.png">
</div>
</span>
I created a circle border around the image, but I just can't get the icon to the exact middle of the circle. The icon sits on the bottom right of the circle.
Here is my CSS for the circle border:
.cat_circle {
border: 3px solid #7E9CC2;
border-radius: 50%;
width: 25px;
height: 25px;
overflow: hidden;
position: absolute;
padding: 30px;
left: 10px;
top: 10px;
text-align: center;
vertical-align: middle;
}
I then started fiddling with the actual png image and I gave it negative margins like this:
.cat_icon {
margin-top: -10px;
margin-left: -18px;
}
I mean it seems to work and I have my icon in the middle of the circle, but is this the right way I should be approaching this??
Here is my fiddle: https://jsfiddle.net/ox0anvL7/