Jonathan Wood
Jonathan Wood

Reputation: 67283

Manually Striping Bootstrap Table

I like the way the table-striped class shades every other row in my table.

But I have a need to shade groups of rows. Is there an easy way (preferably with CSS and no JavaScript) to apply the same shading to individual rows myself?

For example, I'm showing a daily menu, and I want to highlight every food within the same meal the same.

Upvotes: 0

Views: 1245

Answers (1)

Yotam Omer
Yotam Omer

Reputation: 15376

You can use the Contextual classes of bootstrap:

.active - Applies the hover color to a particular row or cell

.success Indicates a successful or positive action

.info Indicates a neutral informative change or action

.warning Indicates a warning that might need attention

.danger Indicates a dangerous or potentially negative action

Or you can create new classes of your own with custom colors.. for e.g.

.lunch{ background:orange; }

And just give this class to any relevant row in your table:

....
<tr class="lunch">...</tr>
....

Upvotes: 3

Related Questions