Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在阅读有关 css3 的 nth-child 的信息,但不知道如何设置第 3,4 行的表格 | 7,8 | 11,12 | 15,16 等是黄色的。基本上每隔 2 行都会设置样式。
谢谢
结合以下:
nth-child(4n+3)
nth-child(4n+4)
nth-child(4n)
table tr:nth-child(4n+3) td, table tr:nth-child(4n+4) td { background: red; }
演示