CSS:选择表格的< td>没有嵌套表的< td> [英] CSS: Selecting table's <td> without the <td>s of nested tables
本文介绍了CSS:选择表格的< td>没有嵌套表的< td>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何选择表的 td 元素,而没有嵌套表的 td ?我想到了以下选择器: table>身体&td
以确保我没有嵌套表的 td 元素,但是我想有更好的方法吗?
How do you select the td elemennts of a table, without the td's of the nested tables ?
I thought of the following selector: table > tbody > tr > td
to make sure I don't have the td elements of the nested tables, but I guess there is a better way ?
推荐答案
所以你有这个吗?
<table id="outer">
<tbody>
<tr>
<td>
<table id="anotherTable">
...
</table>
<td>
<tr>
</tbody>
</table>
您只想在根表中选择td.
And you want to only select td's in the root table.
#outer>tbody>tr>td
就像您输入问题一样(直接子选择器).
Just like you entered in your question (direct child selectors).
这篇关于CSS:选择表格的< td>没有嵌套表的< td>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文