Set text color of Bootstrap 5 striped table

Viewed 17

I need to set the text color for each row in a striped table. When I add the color class to the table, it only affects the even rows. This solution worked for Bootstrap v3, but I recently upgraded to Bootstrap v5. Is there another way that I can accomplish this with Bootstrap v5?

See the example of the issue below. I've identified where the original (not red) color is coming from, but I don't know how to override it. I don't want to set a specific style, because I have multiple tables and each table has it's own text color.

enter image description here

1 Answers

You can overwrite --bs-table-striped-color css variable like this:

<table class="table table-striped" style="color: red; --bs-table-striped-color: red;">
Related