0
My goal is to get this vertical alignment:
I need to align vertically and horizontally the contents of div's
busca
and buscaImovel
consecutively.
Horizontal alignment works but vertical alignment does not work.
What am I doing wrong?
Obs.: I tried to put position: relative; in the search div but both search and searchImovel disappeared.
CSS
.busca {
top:370px;
height:240px;
background-image:url(../../_img/fundo_ap.jpg);
background-repeat:no-repeat;
background-size:cover;
}
.buscaImovel {
position:relative;
top:20px;
width:100%;
height:200px;
background-color:rgba(0,0,0,0.6);
text-align:center;
-webkit-border-radius: 20px 20px 20px 20px;
-moz-border-radius: 20px 20px 20px 20px;
border-radius: 20px 20px 20px 20px;
}
.campoBusca {
position:relative;
top:20px;
}
.camposBusca, .alternativaEscolha {
display:inline-block;
}
HTML
<div class="busca">
<div class="buscaImovel"><br />
<h1 >Pesquise pelo imóvel que deseja</h1>
<form action="busca.php" method="post">
<div class="camposBusca">
<label class="labelPequeno">Tipo</label><br />
<select class="typeTextMedio" id="tipo" name="tipo" required>
<option value="">Escolha o Tipo</option>
</select>
</div>
<div class="camposBusca">
<label class="labelPequeno">Bairro</label><br />
<select class="typeTextMedio" id="bairro" name="bairro" required>
<option value="Indiferente">Indiferente</option>
</select>
</div>
<div class="camposBusca">
<button>Buscar</button>
</div>
</form>
<div style="height:15px;"></div>
<div class="alternativaEscolha">
<a href="buscaAvancada.php"><label class="labelGrande" style="background-color:#CCC;">Busca Avançada</label></a>
</div>
<div class="alternativaEscolha">
<!--abrir popUp-->
<a href="buscaCodigo.php"><label class="labelGrande" style="background-color:#CCC;">Busca por Código</label></a>
</div>
</div>
</div>
As it stands, the content of div busca
, when on a screen of 320px
X 480px
, surpasses the lower div and becomes a mess
Do you want it to be in the middle vertically? put "position: relative;" in . search
– Fleuquer Lima
http://answall.com/questions/2817/qual-a-melhor-forma-de-centralizar-um-elemento-vertical-e-horizontalmente
– M8n
position: relative.took the Divs to places away from their original positions and one didn’t even get inside the other
– Carlos Rocha
I could not center ms managed to push down that is not a correct way to work doing in the search divImovel position:relative; and top:20px;. But if anyone can help me, thank you! I cannot place postion Absolut as per Lik’s guidance above because otherwise I will be forced to change all css because of the position of the various other Divs.
– Carlos Rocha