问题
I have a basic HTML table like so:
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
I want to add a toolbar above it. Would it be semantically acceptable to add a toolbar as a row in the thead
?
<table>
<thead>
<tr>
<th colspan="2">
<!-- toolbar buttons -->
</th>
</tr>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
回答1:
IMHO, since the toolbar is related to the tabular data, I see no semantic issue with having that toolbar live in a row in the thead
.
来源:https://stackoverflow.com/questions/12959480/adding-a-toolbar-to-a-table-following-html-semantics