CSS: selecting a table <td> without <td> s nested tables

How do you select td table elements without td nested tables?
I thought of the following selector: table > tbody > tr > tdto make sure I don't have td elements of nested tables, but I think there is a better way?

+6
source share
3 answers

So do you have it?

<table id="outer">
   <tbody>
      <tr>
         <td>
            <table id="anotherTable>
            ...
            </table>
         <td>
      <tr>
   </tbody>
</table>

And you want to select only etc in the root table.

#outer>tbody>tr>td

Just as you entered into your question (direct child selectors).

+6
source

The easiest way is to add an identifier or class to that very external table, and then use it in your selector:

table#id > tbody > tr > td
+6
source

, , , , . , . , , , .

0
source

All Articles