How do I change the hover over color for a hover over table in Bootstrap?

前端 未结 11 1895
情歌与酒
情歌与酒 2021-01-30 02:58

I have a table with class \'table-hover\'. The default hover over color is a white / light grey. How do I change this color?

I\'ve tried overwriting the default by ad

相关标签:
11条回答
  • 2021-01-30 03:15

    This was the most simple way to do it imo and it worked for me.

    .table-hover tbody tr:hover td {
        background: aqua;
    }
    

    Not sure why you would want to change the heading color to the same hover color as the rows but if you do then you can use the above solutions. If you just want t

    0 讨论(0)
  • 2021-01-30 03:17

    Try Bootstrap’s .table-hover class to implement hoverable rows, for example

    <table class="table table-hover">
      ...
    </table>
    
    0 讨论(0)
  • 2021-01-30 03:19
    .table-hover tbody tr:hover td {
        background: #ffffff;
    }
    
    0 讨论(0)
  • 2021-01-30 03:19

    Instead of changing the default table-hover class, make a new class ( anotherhover ) and apply it to the table that you need this effect for.

    Code as below;

    .anotherhover tbody tr:hover td { background: CornflowerBlue; }
    
    0 讨论(0)
  • 2021-01-30 03:21

    Give this a try:

    .table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
      background-color: #color;
    }
    
    0 讨论(0)
  • 2021-01-30 03:22

    try:

    .table-hover > tbody > tr.active:hover > th {
                    background-color: #color;
                }
    
    0 讨论(0)
提交回复
热议问题