0
I am not managing to center my Father block (red block) in the center. I want it to stay in the center so that even after zooming in on the page it’s still centered. I’m not being able to access the properties of "margin", "border" and "padding" through css, or change the white background behind the Pai block (red). I am inciante and I am studying html and css. I ask understanding. OBS: Zeroing the css I managed to change the property "margin", but I didn’t want to.
HTML:
<div class="principal">
<header class="header">
Cabeçalho! Faça suas pesquisas aqui!
</header>
<article class="busca">
<form class="form" method="POST" action="classes/Controller.php">
CEP: <input type="text" name="cep" placeholder="Insira o cep" required/>
<input type="submit" /></p>
</form>
</article>
<article class="data">
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
Endereço aqui! Endereço aqui! Endereço aqui!<br>
</article>
<footer class="rodape">
Rodapé! Todos os direitos reservados.
</footer>
</div>
CSS:
.principal{
margin:0;
position:fixed;
background-color: red;
width:600px;
height:600px;
padding:1px;
border:0;
}
.header{
position:relative;
top:12%;
text-align:center;
font-size:150%;
font-family:Georgia;
text-transform: uppercase;
}
.busca{
position:relative;
top:17%;
background-color:purple;
height:150px;
width:580px;
margin-left:10px;
margin-right:10px;
border-radius:10px 10px 0px 0px;
text-align:center;
}.form{
font-size:20px;
position:relative;
background-color:pink;
top:50px;
}
.data{
position:relative;
top:100px;
background-color:yellow;
height:150px;
text-align:center;
font-family:Arial;
margin-left:10px;
margin-right:10px;
border-radius:0px 0px 10px 10px;
}
.rodape{
position:relative;
top:110px;
text-align:center;
}
It worked perfectly and I understood its explanation! But I still could not change the blank part of bg. The white part behind the div Pai
– Anderson
That’s what you put it for
body{ background-color: black; }
... will stay with black background– Sam
Thank you for the information. If you are not asking for it, I would like to ask one more question. How would you leave the div Pai (red) occupying the whole top and bottom, even zooming in, tbm?
– Anderson
I managed to change the height of the div Pai to 100% Thank you!
– Anderson
That’s right ;)
– Sam