如何为tr的第三个子项设置样式JUST

时间:2014-11-26 06:57:10

标签: css html-table

我有一张桌子,我有七张桌子。我想为tr的第三个孩子设置display: none,只为那个孩子设置!

如何设置此样式?

4 个答案:

答案 0 :(得分:0)

:nth-child选择器与常量表达式一起用作参数,以隐藏第三列中的tdth

td:nth-child(3), th:nth-child(3) {
  display: none;
}

Demo

答案 1 :(得分:0)

使用nth-of-type CSS选择器仅对ID tr的表格元素td的第三个#table元素进行样式化,如下所示:

#table > tr:nth-of-type(3) {
    display: none
}

答案 2 :(得分:0)

如果您使用的是JQuery,可以执行以下操作:

$('tr').find('td:eq(3)').hide();

或者,用css你可以做到:

tr > td:nth-child(3) {display: none;}

答案 3 :(得分:0)

<tr style="display:none;">