我正在使用 css3 选择器来选择不同的 child 。是他们的替代方案而不是硬编码
.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;
}
最佳答案
有两种选择
You can use odd even
:nth-child(odd)
{
width: 100px;
}
:nth-child(even)
{
width:200px;
}
另一种方法是您必须制定 an+b 。然后就可以了,让我知道你的 html。我会试着告诉你 an+b 形式。
关于css3 选择器,第 n 个 child 递增 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25074028/