给你写好了,你看看,其实重点就是用到了选择器:nth-child(odd),和border-radius(边框圆角)
html
排名 | 姓名 |
1 | 张三 |
2 | 李四 |
3 | 王二 |
4 | 麻子 |
css
*{padding: 0;margin: 0;font-size: 12px;}
table td{padding: 10px;border: 0 none;}
table tbody tr:nth-child(odd){background: #e5f0f8;}
table .sort{width: auto;height: 16px;line-height: 15px;padding: 0 4px;color: #fff;border-radius: 100%;background: #2ea7e0;display: inline-block;overflow: hidden;}
效果
不用js是吗,首先给1、2、3公共的class,class的样式是公共的样式除了背景颜色,然后给1、3、5一个单独的class,给2、4、6另外一个单独的class,这两个class里面的颜色不一样就行了
1
2
3
4
1 |
2 |
3 |
颜色可能不太对,你可以自己改一下
无标题文档
排序 |
---|
1 |
2 |
3 |