0
Good evening everyone, I am trying to change the color of a row in a table with the table-Striped (zebrad) class, but it seems that the table-Striped rule overrides my rule: tr class="{$p->quantity <= 1 ? 'bg-Danger' : ''}}" as you can see in the code below:
<table class="table table-striped table-bordered">
<thead class="thead-dark">
<td class="bg-primary"><strong>Nome</strong></td>
<td class="bg-primary"><strong>Valor</strong></td>
<td class="bg-primary"><strong>Descrição</strong></td>
<td class="bg-primary"><strong>Qtde</strong></td>
<td class="bg-primary"><strong>Tamanho</strong></td>
<td class="bg-primary"><strong></strong></td>
<td class="bg-primary"><strong></strong></td>
</thead>
<tbody>
@foreach($produtos as $p)
<tr class="{{$p->quantidade <= 1 ? 'bg-danger' : ''}}">
<td>{{ $p->nome }}</td>
<td>{{ $p->valor }}</td>
<td>{{ $p->descricao }}</td>
<td>{{ $p->quantidade }}</td>
<td>{{ $p->tamanho }}</td>
<td>
<a type="submit" href="/produtos/mostra/{{$p->id}}">
<span class="glyphicon glyphicon-search"></span>
</a>
</td>
<td>
<a type="submit" href="/produtos/remove/{{$p->id}}">
<span class="glyphicon glyphicon-trash text-danger"></span>
</a>
</td>
</tr>
@endforeach
</tbody>
The problem is that my table keeps the red lines only in even columns, when it is an odd column the row is not turning red. But if I remove the table-Striped class my rule works, can anyone help me with this error? Picture of table with error: https://ibb.co/SVSy006 Table image without error: https://ibb.co/z6LcsqL
Hello friend try to force the swap css 'bg-Danger' put 'bg-Danger ! Important'
– CaMar
Thanks for the reply friend, I tried here but without success, I’ve seen some similar problems in other projects asking for help here at Stackoverflow, they force inside the css file seems so the Striped table does not overlap the colors, I think I have to put something like that there. table { bg-Danger ! Important} // But this type of code does not seem to be recognized by css.
– Lincoln Biancardi