Is there a difference between table.class tr, th and table .class tr, th?
Is there a difference between table.class tr, th and table .class tr, th?
回答1
table .class tr
selects this:
<table>
<tbody class="class">
<tr></tr>
</tbody>
</table>
While table.class tr
selects this:
<table class="class">
<tr></tr>
</table>
回答2
table.foo
selects tables with the class foo.
table .foo
selects all elements that have the class foo, and are inside a table.
So your selector before:
table .class tr, th
selects all tr
s that are inside an element which has class class
and is inside a table, as well as all th
s on the page.