Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 设置表格列的样式,但缺少第一行_Html_Css - Fatal编程技术网

Html 设置表格列的样式,但缺少第一行

Html 设置表格列的样式,但缺少第一行,html,css,Html,Css,我有一个简单的HTML表格,我想用下面的CSS设置其中一列的样式 .tableStyles tr td:first-child + td + td { background-color:aquamarine } 我想省略第一行,这样就不会应用任何样式。我试过这样的东西,但没用 .tableStyles tr:not(first-child) td:first-child + td + td { background-color:aquamarine }

我有一个简单的HTML表格,我想用下面的CSS设置其中一列的样式

    .tableStyles tr td:first-child + td + td {

    background-color:aquamarine

}
我想省略第一行,这样就不会应用任何样式。我试过这样的东西,但没用

    .tableStyles tr:not(first-child) td:first-child + td + td {

    background-color:aquamarine

}

您可以帮助吗?

跳过给定类型的第一个元素,并使用

:nth-of-type(n+2)
这是一个有效的解决方案

因此,请尝试:

.tableStyles tr:nth-of-type(n+2) td:nth-of-type(3) {
    background-color:aquamarine
}
:n第n个子项(n+2)将从第2个开始选择

.tableStyles tr:n子级(n+2) { 背景颜色:海蓝宝石
}
第一个孩子
是一个伪类;以冒号作为前缀。它应该是第一个孩子。更正该输入错误,应该可以。只是为了说明问题是由缺少冒号引起的: