Hallo Linuchs,
Erstens muss man dann CSS-Regeln doppelt, also für thead und tbody notieren:
Nein, thead
und tbody
kommt in deinem CSS-Auszug gar nicht vor ;-)
tr > td:nth-of_type(1), tr > th:nth-of_type(1), tr > td:nth-of_type(2), tr > th:nth-of_type(2) { text-align: right; }
Der Selektor ist überspezifiziert. Valides HTML vorausgesetzt sind sowohl td
(table data) als auch th
(table header) Kinder einer tr
.
Du kannst also
td:nth-of-type(1),
th:nth-of-type(1),
td:nth-of-type(2),
th:nth-of-type(2) {
text-align: right;
}
schreiben. Unter Ausnutzung oben genannter Tatsache und unter Beibehaltung der Spezifität wird daraus
tr > :nth-of-type(1),
tr > :nth-of-type(2) {
text-align: right;
}
Bis demnächst
Matthias