Adding a toolbar to a table following HTML semantics

大兔子大兔子 提交于 2019-12-24 10:11:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!