Css 下课后的兄弟姐妹
我目前可以通过执行以下操作获得zebra表: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
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
这个标题听起来像是一个笑话的开头。:)也许答案会有所帮助?这个标题听起来像是一个笑话的开头。:)也许答案能帮上忙?