Content between rows in html table
I need to开发者_开发问答 have a table where each row can have a child table or other content below that row.
Is there any valid way to do this?
Add another <tr>
after the current one with a colspan
which spans all columns and then put another <td>
with a <table>
therein.
<tr>
<td>col1</td>
<td>col2</td>
<td>col3</td>
</tr>
<tr>
<td colspan="3">
<table>...</table>
</td>
</tr>
<tr>
<td>col1</td>
<td>col2</td>
<td>col3</td>
</tr>
The new table will then appear between the rows.
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
problem?
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
You can't put anything inside a table between the rows, all content has to be inside the table cells.
You can add another row, and use colspan
to make it contain a single cell that spans the width of the table, and put the content in that cell.
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</table>
There is no valid way. Only td-s and th-s are allowed in tr You can however put only 1 td in the row, and set it's colspan attribute to the number of columns you have in the table.
精彩评论