ONE NET WIKI Free and professional IT Wiki

How to change the strip background color of the Bootstrap table?

2018-10-29 ONE NET WIKI

1.4-Bootstrap-table-contextual-classes.png

With Bootstrap class table-striped, every other row in the table has the same background color. If you want to change the color or replace it with various background colors, you can do like this:

.table-striped > tbody > tr:nth-child(2n+1) > td, .table-striped > tbody > tr:nth-child(2n+1) > th {
   background-color: red;
}

You can also use (odd) or (even) instead of (2n+1):

.table-striped>tbody>tr:nth-child(odd)>td, 
.table-striped>tbody>tr:nth-child(odd)>th {
   background-color: red; // Choose your own color here
 }
Editor's Note: All the articles in this website are original. If reproduced, please indicate the source and link.
2211
0
All Comments (0)
Expand to publish a comment

Web Development


Web Management


Web Marketing


Web Security