Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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
Css 下课后的兄弟姐妹_Css_Sass - Fatal编程技术网

Css 下课后的兄弟姐妹

Css 下课后的兄弟姐妹,css,sass,Css,Sass,我目前可以通过执行以下操作获得zebra表: tbody tr:nth-child(2n+2) background-color: #f3f7f9 tr:nth-child(2n+1) background-color: #fff tr.row-headers + tr background-color: #fff tr.row-headers + tr + tr background-color: #f3f7f9 对于tr.row-hea

我目前可以通过执行以下操作获得zebra表:

tbody
  tr:nth-child(2n+2)
    background-color: #f3f7f9

  tr:nth-child(2n+1)
    background-color: #fff

  tr.row-headers + tr
    background-color: #fff

  tr.row-headers + tr + tr
    background-color: #f3f7f9
对于tr.row-headers后面的行,我可以分别使用“+tr”和“+tr+tr”强制第一行为#fff,第二行为#f3f7f9,但我不想对后面的其余行执行此操作。我尝试了第n个child(2n+1)和第n个child(2n+2)而不是“+tr”方法,但似乎不起作用。有什么想法吗

tr:nth-child(even) { background-color: #fff; }

tr:nth-child(odd) { background-color: #f3f7f9; }
这就是你想要的吗

或者在其他语法中:

tbody
  tr:nth-child(even)
    background-color: #f3f7f9

  tr:nth-child(odd)
    background-color: #fff
这就是你想要的吗

或者在其他语法中:

tbody
  tr:nth-child(even)
    background-color: #f3f7f9

  tr:nth-child(odd)
    background-color: #fff

这个标题听起来像是一个笑话的开头。:)也许答案会有所帮助?这个标题听起来像是一个笑话的开头。:)也许答案能帮上忙?