I have a div inside the footer, but it is expandable in width, how do I center it? I've already used margin: 0 auto; but it was not.
<footer class="rodape">
<div class="centralizar"></div>
</div>
I have a div inside the footer, but it is expandable in width, how do I center it? I've already used margin: 0 auto; but it was not.
<footer class="rodape">
<div class="centralizar"></div>
</div>
The problem of not centralizing the div is the problem that your 'rodape' class does not have a defined width, and the same goes for the 'centralize' div ...
.rodape{
width:100%;
background:red
}
.centralizar{
width:80%;
background:gray;
margin:0 auto;
padding:20px
}
<footer class="rodape">
<div class="centralizar">qualquer coisa aqui</div>
</div>
If you want a div responsive to self-tuning and it remains centralized use the following css:
.centralizar{width:20%; margin: 0 auto;}
If you want to increase the div, just increase the width of the porce. Remember the position and relative html structure made.