Selettore CSS3, nth Bambino che incrementa per 1
-
26-12-2019 - |
Domanda
Sto usando il selettore CSS3 per selezionare diversi childs.è la loro alternativa invece di hardcoding it
.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;
}
. Soluzione
Ci sono due alternative
You can use odd even
:nth-child(odd)
{
width: 100px;
}
:nth-child(even)
{
width:200px;
}
.
Un altro modo è necessario formulare un + b.Quindi funziona, fammi sapere il tuo html.Ho provato a dirti una forma A + B.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow