1
The idea here is centralizar verticalmente
the radio button
with his label
(horizontally aligned).
Where am I going wrong?
<ul class="formasPgto">
<li>
<input type="radio" name="pagamento" value="pagseguro" id="pagseguro" />
<label for="pagseguro">Pag Seguro</label>
</li>
<li>
<input type="radio" name="pagamento" value="boleto" id="boleto" />
<label for="boleto">Boleto</label>
</li>
<li>
<input type="radio" name="pagamento" value="cartao" id="cartao" />
<label for="cartao">Cartão</label>
</li>
</ul>
CSS
.formasPgto {
list-style: none;
margin: 0 auto;
padding: 0;
width: 800px;
height: 100px;
line-height: 100px;
border: #000 .3px solid;
text-align: center;
}
.formasPgto li {
display: inline-block;
width: 250px;
height: 50px;
border: #000 .3px solid;
vertical-align: middle;
}
.formasPgto li label, .formasPgto li input[type=radio] {
display: inline-block;
vertical-align: middle;
}
I didn’t understand it very well. Come on: the ul box with width: 800px height: 100px. Internal content aligned horizontally: text-Alig: center. Each li width: 250px height: 50px. vertical-align: Middle. Thus li does not align vertically
– Carlos Rocha
In this case you can use this example: https://jsfiddle.net/wgoc40bk/2/
– Miguel
It seems that label can not align vertically with vertical-align: Middle. Is that right? And in this case the feature is to use padding?
– Carlos Rocha
Ha
vertical-align: middle
would give the effect you want if the hand box had display table and the element to centerdisplay: table-cell;
. I will complete the answer min– Miguel
Then I understood correctly. Some elements accept the vertical-aligment without display table, while others do not. In this case I will prefer to use even padding. Thank you. I am entering the tableless world.
– Carlos Rocha
vertical-aligment is useful for example also for aligned elements. Play with vertical-align in this example: https://jsfiddle.net/87vL52fz/ , here the alignment is done in relation to the other 'brother' elements'
– Miguel