I made a basic structure: a wrapper involving 3 divs! Since the first floats to the left, the middle would have its margin defined as 0 auto and the last div floating to the right side. The problem is that the centralized div is not centralizing properly. It does not respect the div wrapper.
This image helps explain what I mean:
Byinspectingtheelement,youcanseethatthemiddledivisnotcenteredrelativetothedivwrapper.Ontherightside,itextendstotheend,butontheleftsideitisbarredbythedivcontainingtheimage.
Code:
.centralizar{
margin: 0 auto;
}
.centralizar-verticalmente{
position: relative;
top: 50%;
transform: translateY(-50%);
}
.wrapper{
background-color: #00568F;
width: 100%;
height: 120px;
}
.logo-esquerdo{
float: left;
}
.nome-center{
display: table;
}
.pesquisa-direito{
float: right;
margin-right: 10px;
position: relative;
bottom: 20px;
}
.pesquisa-direito input{
width: 200px;
height: 25px;
border-radius: 14px;
padding-left: 20px;
outline: none;
}
<div class="wrapper">
<div class="logo-esquerdo">
<img width=""" height="100" src="http://img2.wikia.nocookie.net/__cb20110405214729/gta/pt/images/b/b6/Copyright.png"alt="Logo Empresa" />
</div>
<div class="nome-center centralizar">
<img width="260" height="" src="http://2.bp.blogspot.com/-1hoRnbqhvRY/VHhNU3oDftI/AAAAAAAAF0M/GnVOIj9VFLA/s1600/Android_Logo.png"alt="Nome Empresa" />
</div>
<div class="pesquisa-direito">
<input type="texx" placeholder="Pesquise aqui" />
</div>
</div>