【问题标题】:Hover table rows but still keep background color of some cells悬停表格行但仍保留某些单元格的背景颜色
【发布时间】:2017-01-28 16:42:15
【问题描述】:

我桌子上的一些单元格有背景颜色。表格的行颜色是交替的。我在表格行中创建了一个悬停。当鼠标悬停在一行上时,一些彩色单元格的所有背景颜色都是不可见的。当鼠标指针悬停在行上时,如何悬停但仍保留单元格的背景颜色。我的悬停和备用颜色代码:

CSS:

tr:hover td,
tr.even:hover td.active,
tr.odd:hover td.active {
background-color: #EBEBEB ;
}

jQuery:

$(document).ready(function()
    {
        $("tr:odd").css("background-color", "#dfe7f2");        
    });

【问题讨论】:

    标签: html css hover


    【解决方案1】:

    你可以在纯 CSS 中做到这一点。

    tr:nth-child(odd) {
        background-color: #EBEBEB;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-29
      • 2020-08-28
      • 2020-05-26
      • 2014-03-27
      • 1970-01-01
      • 2011-11-17
      相关资源
      最近更新 更多