延伸|巢狀表格

了解包覆順序即可,通常優先使用簡單表格。

效果與原碼

訂單摘要
訂單編號A001
明細
商品明細
品名數量
筆記本2
<table class="sample">
  <caption>訂單摘要</caption>
  <tr><th scope="row">訂單編號</th><td>A001</td></tr>
  <tr><th scope="row">明細</th><td>
    <table class="sample">
      <caption>商品明細</caption>
      <tr><th scope="col">品名</th><th scope="col">數量</th></tr>
      <tr><td>筆記本</td><td>2</td></tr>
    </table>
  </td></tr>
</table>

內層 table 放在外層 td 裡,先結束內層 table,再結束外層 td。不要直接把 table 放在 tr 裡。

使用時機

一筆資料確實包含一張子表時才使用;只為排版,不必層層包表格。