扫码关注官方订阅号
ringa_lee
你这个ID为“tb1”的元素是第一个表格吗?能提供更多信息吗?
csstr:nth-child(2n)>td:nth-child(2n) { color: #333; background-color: green; } tr:nth-child(2n)>td:nth-child(2n+1) { color: #666; background-color: blue; } tr:nth-child(2n+1)>td:nth-child(2n) { color: #666; background-color: blue; } tr:nth-child(2n+1)>td:nth-child(2n+1) { color: #333; background-color: green; }
css
tr:nth-child(2n)>td:nth-child(2n) { color: #333; background-color: green; } tr:nth-child(2n)>td:nth-child(2n+1) { color: #666; background-color: blue; } tr:nth-child(2n+1)>td:nth-child(2n) { color: #666; background-color: blue; } tr:nth-child(2n+1)>td:nth-child(2n+1) { color: #333; background-color: green; }
scss@mixin style1 { color: #333; background-color: green; } @mixin style2 { color: #666; background-color: blue; } tr { &:nth-child(2n) { &>td:nth-child(2n) { @include style1; } &>td:nth-child(2n+1) { @include style2; } } &:nth-chlid(2n+1) { &>td:nth-child(2n) { @include style2; } &>td:nth-child(2n+1) { @include style1; } } }
scss
@mixin style1 { color: #333; background-color: green; } @mixin style2 { color: #666; background-color: blue; } tr { &:nth-child(2n) { &>td:nth-child(2n) { @include style1; } &>td:nth-child(2n+1) { @include style2; } } &:nth-chlid(2n+1) { &>td:nth-child(2n) { @include style2; } &>td:nth-child(2n+1) { @include style1; } } }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
你这个ID为“tb1”的元素是第一个表格吗?能提供更多信息吗?
Css版
Scss版