Я пересматриваю эти CSS-селектора до Sass:
#romtest .detailed th:nth-child(2),
#romtest .detailed th:nth-child(4),
#romtest .detailed th:nth-child(6),
#romtest .detailed td:nth-child(2),
#romtest .detailed td:nth-child(3),
#romtest .detailed td:nth-child(6),
#romtest .detailed td:nth-child(7),
#romtest .detailed td.last:nth-child(2),
#romtest .detailed td.last:nth-child(4) {
background:#e5e5e5;
}
... и придумал следующее:
#romtest .detailed {
th:nth-child {
&(2), &(4), &(6) {
background:#e5e5e5;
}
}
td:nth-child {
&(2), &(3), &(6), &(7) {
background:#e5e5e5;
}
}
td.last:nth-child {
&(2), &(4) {
background:#e5e5e5;
}
}
}
К сожалению, это вызывает ошибку:
Недопустимый CSSS после "&": ожидаемый "{", был "(2), & (4), & (6) {"
Я также знаю, что это может быть лучше, потому что я:
- повторение цвета фона
- повторяющиеся числа - т.е. (2) и (6)
Как мне реорганизовать эти селектора?