Struggling to horizontally center an image in a div, but for some reason it's just not working. I've centered images many times before, so why is it different this time? Here's what I've attempted...
CSS
#cabeca{
position: relative;
float: left;
width: 100%;
height: auto;
min-height: 290px;
margin: auto;
}
.cabecasize {
width:100%;
min-width: 968px;
height:auto;
min-height: 290px;
overflow:hidden;
left:0;
right: 0;
margin: auto;
}
.cabecafundo{
position: absolute;
width: 100vw;
left: calc(-50vw + 50%);
background-color: black;
height: 100%;
top:0;
z-index: -1;
}
.overcabeca{
overflow: hidden;
display: block;
margin: auto;
text-align: center;
}
HTML
<div id="cabeca">
<div class="overcabeca">
<img src="images/av61.png" alt="av61" class="cabecasize" />
</div>
<div class="cabecafundo">
</div>
</div>
Any thoughts on how to solve this?