简体   繁体   中英

Rails HTML Table: <tr> tag doesn't do anything

<% @user.workstations.each do |ws| %>
  <tr class="red">
    <td class="td_workstation"> <%= ws.name %> </td>
    <td class="td_workstation"> <%= ws.applications %> </td>
  </tr>
<% end %>

The class "red" is supposed to make the background red, but it doesn't do anything. Why isn't it affecting the rows??????

.red {
  background: red;
  font-size: 60px;
}

.td_workstation, .th_workstation {
border: 1px solid #dddddd;
}

Try in your stylesheet changing the .red class to:

tr.red td {
  background-color: red;
  border-collapse:collapse; //Throw this border-collapse in if you want to remove the white margins around each cell after you change the background.
  font-size: 60px;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM