How can I assign the same background color to two rows in a strstrap 3 table?
I have this table and want to have the rows of the table inside a loop with the same colors. By default bootstrap alternates the background colors on each line. But I would like to have two lines grouped together. Do I need to do this? Best regards, Thorsten
<table class="table table-striped">
<tbody>
<cfloop query="items">
<tr>
<td>asdfasdf</td>
</tr>
<tr>
<td>asdfasfd</td>
</tr>
</cfloop>
</tbody>
</table>
+3
source to share
1 answer
Just create your own table class and add the CSS suggested in this answer .
.my-table-class tr {
/* Example color */
background: blue;
}
.my-table-class tr:nth-child(4n+1), .my-table-class tr:nth-child(4n+2) {
/* Example color */
background: red;
}
+1
source to share