Bootstrap表 - 悬停所有行,而不仅仅是所有行

时间:2014-10-02 16:44:34

标签: css twitter-bootstrap-3

我使用Bootstrap 3并将table-striped table-hover应用到我的桌子上。

但是,我已将默认条纹颜色更改为绿色。所以我的栏目有绿白 - 绿 - 白。

现在,当我盘旋时,白色变成蓝色。这可以。但当我将鼠标悬停在果岭上时,它会保持绿色。

如何在悬停时显示每一行#ecf3f8

我试过这个无济于事:

.table-hover tbody tr.odd:hover td, .table-hover tbody tr.odd:hover th {
  background-color: #ecf3f8;
}

3 个答案:

答案 0 :(得分:8)

听起来像是一个特殊问题。请尝试以下方法:

.table-striped.table-hover>tbody>tr:hover>td, 
.table-striped.table-hover>tbody>tr:hover>th {
  background-color: #ecf3f8;
}

答案 1 :(得分:2)

试试这个:

.table-hover tbody tr:hover td {
  background: #ecf3f8 !important;
}

编辑:也试试这个:

.table-hover > tbody > tr:hover > td {
  background: #ecf3f8 !important;
}

答案 2 :(得分:2)

试试这个:

.table-striped tbody tr:hover td,
.table-striped tbody tr:hover th {
    background-color: #ecf3f8
}

您可以在此处试用:http://www.bootply.com/2Gp7XHJ9jV

来源:https://github.com/twbs/bootstrap/issues/3223#issuecomment-5735608