In HTML, browsers implicitly add a tbody
element within which to contain the tr
elements1, so in reality, tr
is never a child of table
.
Consequently, you have to do this instead:
table > tbody > tr > td
Of course, if you add a tbody
element yourself, you use the same selector. The spec explains when a tbody
is added implicitly otherwise:
Tag omission
A tbody
element's start tag may be omitted if the first thing inside the tbody
element is a tr
element, and if the element is not immediately preceded by a tbody thead
, or tfoot
element whose end tag has been omitted.
1 This is not the case for XHTML documents that are properly served as application/xhtml+xml
, however, given its XML roots.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…