seletor css3, enésimo filho incrementando em 1
-
26-12-2019 - |
Pergunta
estou usando o seletor css3 para selecionar filhos diferentes.existe alguma alternativa em vez de codificá-lo
.checkout_main .check_tr th:nth-child(1){
width:50px;padding-left:10px;
}
.check_tr th:nth-child(2){
width:300px;padding-left:10px;
}
.check_tr th:nth-child(3){
width:50px;padding-left:10px;
}
.check_tr th:nth-child(4){
width:100px;padding-left:10px;
}
Solução
Existem duas alternativas
You can use odd even
:nth-child(odd)
{
width: 100px;
}
:nth-child(even)
{
width:200px;
}
Outra maneira é você formular an+b .Então funciona, deixe-me saber seu html.Vou tentar dizer a você a forma an+b.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow