Css样式基础🔥
小杨 2023/10/1 Css
# css奇偶数选择器nth-child
- 示例代码:
.a:nth-child(odd){ background-color: aqua; } //奇数行 .a:nth-child(even){ background-color: red; } //偶数行
- 也可写为:
.a:nth-child(n){ background-color: aqua; } //奇数行 .a:nth-child(2n){ background-color: red; } //偶数行