我有带有rowspan的HTML表格,我希望new_objects = objects.map do |object|
replacement_key = input_types.key(object.input_type)
object.input_type = replacement_key
object
end.as_json
具有不同的寄宿生颜色
td
预期输出为HTML Code;
<table class="table">
<tr>
<td class ="fail-td" rowspan="2">Detail</td>
<td class ="fail-td">Data 1</td>
<td class="event">Event</td>
</tr>
<tr> <td class ="success-td">Data 2</td></tr>
</table>
Snippet:
.fail-td {
border-left: 4px solid #d9534f !important;
}
.success-td {
border-left: 4px solid #5cb85c !important;
}
第二行rowspan
,左边框为绿色
但结果是td
,左边是红色边框
答案 0 :(得分:1)
设置fail-td class name
td
的第二个data 1
的{{1}}
.fail-td {
border-left: 4px solid #d9534f !important;
}
.success-td {
border-left: 4px solid #5cb85c !important;
}
&#13;
<table class="table">
<tr>
<td class="fail-td" rowspan="2">Detail</td>
<td class="fail-td">Data 1</td>
<td class="event">Event</td>
</tr>
<tr>
<td class="success-td">Data 2</td>
</tr>
</table>
&#13;
答案 1 :(得分:0)
table tr td:nth-child(1) {
border-left: 4px solid green;
}
table tr td:nth-child(2) {
border-left: 4px solid red;
}
table tr td:nth-child(3) {
border-left: 4px solid yellow;
}
table tr td:nth-child(4) {
border-left: 4px solid blue;
}
<!-- language: lang-html -->
<table class="table">
<tr>
<td rowspan="2">Detail</td>
<td>Data 1</td>
<td class="event">Event</td>
</tr>
<tr>
<td>Data 2</td>
</tr>
</table>
<!-- end snippet -->