search

Home  >  Q&A  >  body text

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

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

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

不太会

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

就这两个效果 有人会吗

高洛峰高洛峰2889 days ago462

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 09:24:03

    CSS pseudo classes:

    tr:nth-child(odd), tr:nth-child(odd) td, tr:nth-child(odd) p {
      background: #0F0;
    }
    
    tr:nth-child(even), tr:nth-child(even) td, tr:nth-child(even) p {
      background: #00F;
    }
    
    tr:hover, tr:hover td, tr:hover p {
      background: #F00;
    }

    reply
    0
  • 迷茫

    迷茫2017-04-18 09:24:03

    The answer is so fast! I would say the first floor answer is very good. The subject can be used.

    reply
    0
  • Cancelreply