Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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 cssnth表向导_Html_Css - Fatal编程技术网

Html cssnth表向导

Html cssnth表向导,html,css,Html,Css,我正试图利用第n个孩子让表2工作。它只需要显示表2中的第11-20行,我似乎无法找出我做错了什么。有什么帮助吗 表1应显示第1-10行–这是可行的 表2应该显示第11-20行–当前显示的是11-end(我无法让它停在20) 表3应显示21-30–这是可行的 table.style1 { border-collapse: collapse; } table.style1 > tbody > tr:nth-child(n + 11) { display: none; }

我正试图利用第n个孩子让表2工作。它只需要显示表2中的第11-20行,我似乎无法找出我做错了什么。有什么帮助吗

表1应显示第1-10行–这是可行的 表2应该显示第11-20行–当前显示的是11-end(我无法让它停在20) 表3应显示21-30–这是可行的

table.style1 {
    border-collapse: collapse;
}

table.style1 > tbody > tr:nth-child(n + 11) {
    display: none;
}

table.style2 {
    border-collapse: collapse;
}

table.style2 > tbody > tr:nth-child(-n + 10):nth-child(-n + 19) {
    display: none;
}

table.style3 {
    border-collapse: collapse;
}

table.style3 > tbody > tr:nth-child(-n + 20) {
    display: none;
}

您可以执行以下操作。

table.style2>tbody>tr:n个孩子(-n+10),table.style2>tobdy>tr:n个孩子(n+21){
显示:无;
}

而不是:

table.style2 > tbody > tr:nth-child(-n + 10):nth-child(-n + 19) {
  display: none;
}
使用:


请显示完整的代码。请显示HTML,然后创建一个代码段来显示您的示例。对于
style2
tr:nth child(-n+10):nth child(-n+19)
,您是错误的。使用
table.style2>tbody>tr:n子项(-n+10),table.style2>tobdy>tr:n子项(n+21)
代替@我说,@andrewli的解决方案很有效。非常感谢!这正是我想要的。非常感谢你的帮助!
table.style3 {
border-collapse: collapse;
}

table.style3 > tbody > tr:nth-child(-n + 20) {
display: none;
}
table.style2 > tbody > tr:nth-child(-n + 10):nth-child(-n + 19) {
  display: none;
}
table.style2 > tbody > tr:nth-child(-n + 10),
table.style2 > tbody > tr:nth-child(n + 21) {
  display: none;
}