我創建了一個Rails 4示例應用程序。我添加了twitter-bootstrap-rails gem並使用安裝程序設置了所有文件:rails generate bootstrap:install less
。然後,我創建了一個腳手架並遷移了數據庫,並且bootstrap.css顯示爲應該。然後我手動創建了一個模型/視圖/控制器,沒有腳手架,引導程序的CSS也沒有被使用。這是我的觀點:Rails 4添加引導程序
<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>
我應該有條紋的表,但它不工作。有任何想法嗎?謝謝。
你用什麼瀏覽器?你可以在你的瀏覽器上看到style td(奇數)使用inspect元素工具嗎?如果你能看到'.table-striped tbody> tr:nth-child(odd)> td,.table-striped tbody> tr:n-child(odd)> th {background_color:#f9f9f9; },表示你的顯示器無法區分相鄰的顏色 –
不,在檢查員中我看不到任何Bootstrap類。 – jhamm
你確定在佈局上調用樣式表嗎? –