我在桌子里面有一张儿童桌。用于插入新表的rowspan。
现在我的问题是当主表格单元格的内容增加时,各个单元格的子行也应该被扩展。
这是表结构
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td rowspan="3">
<table border="0" class="child_table" cellspacing="0" cellpadding="0">
<tr>
<td>Sub col 1</td>
<td>Sub col 2</td>
</tr>
<tr>
<td>Sub col 1</td>
<td>Sub col 2</td>
</tr>
</table>
</td>
<td>Col 4</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>When the content of this cell increases I want the 2nd (respective) row of child table also to extend accordingly.</td>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 4</td>
</tr>
</table>
答案 0 :(得分:0)
<强> jsBin demo 强>
table{
background:#C2E5FF;
position:relative;
height:100%; /* Set 100% height */
}
td{
border:1px solid #ccc;
vertical-align:top;
width:20%
/* Don't use height */
}
.child_table{
background:#FFFFCA;
width:100%; /* Set width to 100% */
}