6

I'm using Bootstrap 3 and applied table-striped table-hover to my table's class.

However, I have changed the default striped color to green. So I have green - white - green - white for my columns.

Now, when I hover, the white turns to blue. This is fine. But when I hover over the green, it stays green.

How can I have every row, on hover, show #ecf3f8?

I've tried this to no avail:

.table-hover tbody tr.odd:hover td, .table-hover tbody tr.odd:hover th {
  background-color: #ecf3f8;
}
benomatis
  • 5,536
  • 7
  • 36
  • 59
asgwar12
  • 131
  • 1
  • 9
  • possible duplicate of [Bootstrap table striped: how do I change the strip background colour?](http://stackoverflow.com/questions/20825211/bootstrap-table-striped-how-do-i-change-the-strip-background-colour) – benomatis Oct 02 '14 at 16:48
  • Not at all. I've already changed it -- my question is much different. – asgwar12 Oct 02 '14 at 16:51
  • true that, i incorrectly flagged that one, sorry. – benomatis Oct 02 '14 at 16:54

3 Answers3

9

Sounds like a specificity problem. Try the following:

.table-striped.table-hover>tbody>tr:hover>td, 
.table-striped.table-hover>tbody>tr:hover>th {
  background-color: #ecf3f8;
}
Brandon Poe
  • 461
  • 4
  • 10
3

Try this:

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

You can try it here: http://www.bootply.com/2Gp7XHJ9jV

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

benomatis
  • 5,536
  • 7
  • 36
  • 59
2

try this:

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

edit: also try this:

.table-hover > tbody > tr:hover > td {
  background: #ecf3f8 !important;
}
scooterlord
  • 15,124
  • 11
  • 49
  • 68