Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap danger class not working for a table row

I have the following table in my Rails app:

<table class='table table-bordered table-hover table-striped'>
    <thead>
      <tr>
        <th>ID</th>
        <th>Status</th>
      </tr>
    </thead>

    <tbody>
      <tr class='danger'>
        <td><%= order.id %></td>
        <td><%= order.status.name %></td>
      </tr>
    </tbody>
  </table>

And the row with class 'danger' doesn't change the color. However, if I use the class 'success' it changes correctly.

I am using the twitter-bootstrap-rails gem.

like image 365
Hommer Smith Avatar asked May 28 '14 21:05

Hommer Smith


People also ask

What is table responsive in bootstrap?

The .table-responsive class creates a responsive table. The table will then scroll horizontally on small devices (under 768px).

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. Example: HTML.

What is table-condensed in bootstrap?

table-condensed is a class in Bootstrap 3 Framework. It can be used when we want to have row padding half so that we can condense the table. So that I can be more user-friendly. Thus .


2 Answers

twitter-bootstrap gem is currently using bootstrap v 2.3.2.

And as per the Bootstrap version 2.3.2 Documentation For Tables following are the available row classes:

Optional row classes

Use contextual classes to color table rows.

.success    Indicates a successful or positive action.
.error      Indicates a dangerous or potentially negative action.
.warning    Indicates a warning that might need attention.
.info       Used as an alternative to the default styles.

Which is why .success worked but NOT .danger.

I suppose you are looking for .error class.

like image 151
Kirti Thorat Avatar answered Sep 25 '22 02:09

Kirti Thorat


it seems to be a know bug with tables.

Looks like this is a know bug in v3.0.3 and will be fixed in v3.1.0

refer this bug error page and this stack question

like image 22
faby Avatar answered Sep 27 '22 02:09

faby