I have an element with an image inside and I want to center it. I'm using position: absolute but it does not work properly. Here is the code:
<div class="wraper">
<div class="main"><img src="image.jpg" alt=""></div>
</div>
.wrapper {
position: relative;
.main {
margin-top: -157px;
margin-left: -157px;
position: absolute;
top: 50%;
left: 50%;
width: 314px;
height: 314px;
line-height: 314px;
background: #000;
border-radius: 50%;
text-align: center;
img {
vertical-align: middle;
}
}
}