2014-10-02 93 views
3

我使用Bootstrap 3並將table-striped table-hover應用於我的表的類。Bootstrap table-hover所有行,而不僅僅是其他所有行

但是,我已將默認條紋顏色更改爲綠色。所以我的專欄有綠色 - 白色 - 綠色 - 白色。

現在,當我盤旋時,白色變成藍色。這可以。但是當我盤旋在綠色,它保持綠色。

我怎樣才能讓每一行在懸停時顯示#ecf3f8

我已經試過這無濟於事:

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

[引導表條紋的可能重複:我如何更改帶背景顏色?](http://stackoverflow.com/questions/20825211/bootstrap-table-striped-how-do-i-change-the-strip-background-colour) – webeno 2014-10-02 16:48:44

+0

N完全沒有。我已經改變了它 - 我的問題非常不同。 – asgwar12 2014-10-02 16:51:37

+0

的確如此,我錯誤地標記了那個,對不起。 – webeno 2014-10-02 16:54:47

回答

6

聽起來像一個專一的問題。請嘗試以下操作:

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

沒有效果...(我不是OP);) – webeno 2014-10-02 17:09:44

+0

它似乎在這裏做的竅門:http:// codepen .io/btpoe/pen/Faecb – 2014-10-02 17:11:22

+0

是的,我錯過了'table-hover'位 – webeno 2014-10-02 17:14:36

2

試試這個:

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

編輯:也嘗試這個辦法:

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

這一個完全沒有效果... – webeno 2014-10-02 17:01:05

+0

它應該如果你上面提到的類是正確的。 – scooterlord 2014-10-02 17:02:24

+0

使用簡單的表,沒有大驚小怪,這些都沒有效果,嘗試它在bootply(我不是OP);) – webeno 2014-10-02 17:10:11

相關問題