Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap: tr class "warning" doesn't work in striped-table

I've got a table defined <table class="table table-striped"> with some rows like <tr class="success">, <tr class="info">, and <tr class="warning">.

The success and info table-rows show up fine: red and blue just as they should be. But the warning rows don't show yellow as expected. They're just regular, zebra-stripe white or gray.

Weird thing is, if I add table-hover to the table's classes, the warning rows will show yellow, but only when hovered. The success and info rows, however, always show their colors, hover or no.

like image 889
Jonathan Avatar asked Sep 18 '13 04:09

Jonathan


People also ask

What makes bootstrap striped table?

table-stripped class is used to create an alternate dark and light rows. Use the combination of table and table-stripped classes within the <table> tag to create a striped table.

Which bootstrap 4 class can be used to make a borderless table?

Add .table-borderless for a table without borders.

What is table hover in Bootstrap?

Using the . table-hover class, a light gray background will be added to rows while the cursor hovers over them.


1 Answers

Regarding this issue with v3.0.3 (which will be fixed in v3.1, whenever they release it), a quick/rough fix for this is to add !important overrides to some specific CSS for this issue:

.table-striped > tbody > tr > .danger,
.table-striped > tbody > .danger > td,
.table-striped > tbody > .danger > th {
  background-color: #f2dede !important;
}

Obviously add this for thead, tfoot etc and success, info etc if you use those. I'm only using danger, and only in the tbody. I put these modifications in my bootstrap.css file, so that when I upgrade to v3.1 it will update anyway.

like image 72
scrowler Avatar answered Oct 05 '22 02:10

scrowler