我基於數據庫的一些字段生成表,並且我需要爲每個表指定不同的樣式。如何爲每個表格指定不同的樣式。指定每個表的不同樣式
這是我的代碼
<table width="100%">
<% @content_data['personnel_cv_data_types'].each do |personnel_cv_data_type| %>
<tr width="100%">
<td>
<fieldset>
<legend>
<table style="font-size:13px;"width="100%" class="personnel_cvdata_view_table_first_row">
<tr>
<td>
<%= @content_data['lable_title_'+personnel_cv_data_type] %>
</td>
<td>
<a onClick="add_new_entry('<%= personnel_cv_data_type %>')">Add <%= @content_data['lable_add_'+personnel_cv_data_type] %></a>
</td>
</tr>
</table>
</legend>
這裏每個表採用相同的風格personnel_cvdata_view_table_first_row,怎麼可能產生具有不同風格類表例如
class="personnel_cvdata_view_table_first_row_1"
class=""ersonnel_cvdata_view_table_first_row_2
等的,我可以爲每個表格分別編寫風格
你想交替/'斑馬'類嗎?或者只是分配給他們的唯一號碼?或記錄的ID?請澄清。 –
對不起沒有其他選擇我需要每個表的不同風格,因爲字段形式數據庫是不同的長度(名稱,教育資格,工作經驗),所以我想組織他們在良好的格式。 – Jens