-1

I have created a Rails 4 sample app. I added the twitter-bootstrap-rails gem and used the installer to set up all the files: rails generate bootstrap:install less. I then created a scaffold and migrated the database and the bootstrap.css showed up like it should of. I then created a model/view/controller by hand with no scaffolding and the bootstrap css is not being used on it. Here is my view:

<table class="table table-striped">
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
    </tr>
  </thead>
    <tr>
      <td>Jason</td>
      <td>John</td>
    </tr>
  <tbody>

  </tbody>
</table>

I should have a striped table, but it is not working. Any ideas? Thanks.

madth3
  • 7,275
  • 12
  • 50
  • 74
jhamm
  • 24,124
  • 39
  • 105
  • 179
  • what browser do you use? Can you see style td(odd) use inspect element tool on your browser? if you can see `.table-striped tbody > tr:nth-child(odd) > td, .table-striped tbody > tr:nth-child(odd) > th { background-color: #f9f9f9; }`, signify your monitor can't distinguish the color of adjacent – rails_id Jul 03 '13 at 02:19
  • No, in the inspector I dont see any of the Bootstrap classes. – jhamm Jul 03 '13 at 10:23
  • are you sure have call stylesheet on layout? – rails_id Jul 03 '13 at 12:12

2 Answers2

1

IS it a copy paste error or is it your code?

notice that the row is not in the tbody and you only have one row put more then one to see if it is striped

Oz Ben-David
  • 1,589
  • 1
  • 16
  • 26
0

Check in browser if your bootstrap classes are coming you can do this by searching for any bootstrap class in complied css . if it is not there check in application css file in assets folder if bootstrap is included or not ... also correct your markup ...

<table class="table table-striped">
 <thead>
  <tr>
   <th>Name</th>
   <th>Age</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>Jason</td>
   <td>John</td>
  </tr>
 </tbody>
</table>
ravisuhag
  • 1,778
  • 1
  • 11
  • 16