I have a div
that is 100% and has a background image.
.bannerTotalHome {
background: url("../imagens/bannerTotalHome.jpg") no-repeat center;
width: 100%;
height: 570px;
margin: 0 auto;
}
And inside there will be another div
that will have a background image.
.logoHome {
background: url("../imagens/logoHanka.png") no-repeat center;
width: 285px;
height: 152px;
position: absolute;
left: 50%;
margin-left: -142.5px;
}
What happens, is that I centralized the logo using position
, I do not know if this is the most correct form, or if there is an easier way to do it?
My HTML looks like this:
<div class="bannerTotalHome p-relative">
<div class="logoHome margin-top-110"></div>
<div class="margin-top-375 d-block">
<h2>SUA MELHOR ESCOLHA EM</h2>
<h1>COMPONENTES AUTOMOTIVOS</h1>
</div>
</div>
In this case, if I use a margin-top
within that div bannerTotalHome
it will play the div down well. So I ask if the correct one to center that div inside the other is the way I did it.