17

While working on a Bootstrap-based project, I came across a strange issue where some of the styling was being overridden by the user agent stylesheet (in Chrome and Firefox). I found this related issue, which was solved by including the <!DOCTYPE html> tag I had initially omitted. But now I can't get the .table-inverse, .thead-inverse, or .thead-defaultclasses to shade my table headers. As far as I understand, I have all the necessary rows, containers, etc in place.

Why isn't the shading working?

.navbar {
  border-radius: 0px
}
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />

<h2 class="display-1">Bootstrap 4 Inverse Table</h2>

<div class="container">
  <div class="row">
    <div class="col-md-6 col-md-offset-3">
      <table class="table table-inverse">
        <thead>
          <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Username</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">1</th>
            <td>Mark</td>
            <td>Otto</td>
            <td>@mdo</td>
          </tr>
          <tr>
            <th scope="row">2</th>
            <td>Jacob</td>
            <td>Thornton</td>
            <td>@fat</td>
          </tr>
          <tr>
            <th scope="row">3</th>
            <td>Larry</td>
            <td>the Bird</td>
            <td>@twitter</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>

View on JSFiddle

Community
  • 1
  • 1
Bradley Parker
  • 173
  • 1
  • 1
  • 4

5 Answers5

26

For anyone like me finding this thread but using Bootstrap 4.0.0-beta.2 or later, table-inverse and thead-inverse have been replaced with -dark per the version release information linked here

superbeck
  • 501
  • 1
  • 4
  • 9
23

Be sure you are using < th > instead < td > into header.

Edgar Diaz
  • 279
  • 2
  • 2
12

You have to add bootstrap-X.X-flex.css too.

bootstrap-X.X.css
bootstrap-X.X-flex.css
bootstrap.js

Where X.X is the version number

OR

Use this CDNs:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha/js/bootstrap.min.js"></script>
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
4

It happens for the older versions of bootstrap only. Because the class thead-inverse is not available there. You can just add this design to your design css I hope it will definitely work as I have done so. The reason behind this is thead-inverse is only available in recent versions of bootstrap.css only.

.thead-inverse th {
            color: #fff;
            background-color: #373a3c;
        }
Ananda G
  • 2,389
  • 23
  • 39
2

Easy enough. The CSS sheet you're linking to in your fiddle doesn't include the .table-inverse styling.

  • 1
    I knew you could pick and choose which bootstrap JS files to download, but I thought that all bootstrap CSS came in one file. Where do I find the additional CSS files for things like the `.table-inverse` styling? – Bradley Parker Feb 08 '16 at 14:56