css - 1.table奇偶行显 不同的颜色 2.鼠标放在每一行上都变颜色 怎么实现!!!!!

查看:58
本文介绍了css - 1.table奇偶行显 不同的颜色 2.鼠标放在每一行上都变颜色 怎么实现!!!!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

在网上找了很多 但是都实现不了 这个效果

是不是在设置它类型的要给table一个ID或者class 还是怎样!

不太会

奇偶行显示不同的颜色 鼠标放在上面也变颜色

就这两个效果 有人会吗

解决方案

CSS pseudo classes:

tr:nth-child(odd), tr:nth-child(odd) td, tr:nth-child(odd) div {
  background: #0F0;
}

tr:nth-child(even), tr:nth-child(even) td, tr:nth-child(even) div {
  background: #00F;
}

tr:hover, tr:hover td, tr:hover div {
  background: #F00;
}

这篇关于css - 1.table奇偶行显 不同的颜色 2.鼠标放在每一行上都变颜色 怎么实现!!!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆