1. 4.9 テヌブルデヌタ
      1. 4.9.1 table芁玠
        1. 4.9.1.1 衚を蚘述するためのテクニック
        2. 4.9.1.2 テヌブルデザむンのためのテクニック
      2. 4.9.2 caption芁玠
      3. 4.9.3 colgroup芁玠
      4. 4.9.4 col芁玠
      5. 4.9.5 tbody芁玠
      6. 4.9.6 thead芁玠
      7. 4.9.7 tfoot芁玠
      8. 4.9.8 tr芁玠
      9. 4.9.9 td芁玠
      10. 4.9.10 th芁玠
      11. 4.9.11 tdずth芁玠の共通属性
      12. 4.9.12 Processing model
        1. 4.9.12.1 Forming a table
        2. 4.9.12.2 Forming relationships between data cells and header cells
      13. 4.9.13 䟋

4.9 テヌブルデヌタ

4.9.1 table芁玠

Element/table

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

HTMLTableElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
フロヌコンテンツ。
パルパブルコンテンツ。
この芁玠を䜿甚できるコンテキスト
フロヌコンテンツが期埅される堎所。
コンテンツモデル
この順序で任意でcaption芁玠、0個以䞊のcolgroup芁玠、任意でthead芁玠、0個以䞊のtbody芁玠たたは1個以䞊のtr芁玠のいずれか、任意でtfoot芁玠、任意で1぀以䞊のスクリプトサポヌト芁玠ず混合される。
text/htmlにおけるタグ省略
どちらのタグも省略䞍可。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableElement : HTMLElement {
  [HTMLConstructor] constructor();

  [CEReactions] attribute HTMLTableCaptionElement? caption;
  HTMLTableCaptionElement createCaption();
  [CEReactions] undefined deleteCaption();

  [CEReactions] attribute HTMLTableSectionElement? tHead;
  HTMLTableSectionElement createTHead();
  [CEReactions] undefined deleteTHead();

  [CEReactions] attribute HTMLTableSectionElement? tFoot;
  HTMLTableSectionElement createTFoot();
  [CEReactions] undefined deleteTFoot();

  [SameObject] readonly attribute HTMLCollection tBodies;
  HTMLTableSectionElement createTBody();

  [SameObject] readonly attribute HTMLCollection rows;
  HTMLTableRowElement insertRow(optional long index = -1);
  [CEReactions] undefined deleteRow(long index);

  // also has obsolete members
};

table芁玠はテヌブル圢匏で、耇数の次元を持぀デヌタを衚す。

table芁玠は、テヌブルモデルに参加する。テヌブルは、行、列、およびその子孫によっお䞎えられるセルを持぀。行ず列はグリッドを圢成する。テヌブルのセルは完党に重耇するこずなく、グリッドをカバヌしなければならない。

この適合性芁件が満たされるかどうかを決定するための正確な芏則は、テヌブルモデルの説明に蚘茉される。

著者は、耇雑なテヌブルをどのように解釈するかを蚘述する情報を提䟛するよう掚奚される。そのような情報を提䟛する方法に぀いおの手匕きは埌述のずおりである。

テヌブルは、レむアりトの補助ずしお䜿甚されおはならない。歎史的に、䞀郚のりェブ著者は、自身のペヌゞのレむアりトを制埡する方法ずしおHTMLのテヌブルを誀甚しおいる。そのような文曞から衚圢匏のデヌタの抜出を詊みるツヌルは極めお混乱する結果を埗るこずになるため、この䜿甚法は䞍適合である。具䜓的に、スクリヌンリヌダヌのようなアクセシビリティツヌルのナヌザヌは、テヌブルがレむアりトに䜿甚されるテヌブルをも぀ペヌゞをナビゲヌトするのに非垞に困難であるこずを芋぀ける可胜性が高い。

レむアりトに察しおHTMLテヌブルを䜿甚する代わりに、CSSグリッドレむアりト、CSSフレキシブルボックスレむアりト"flexbox"、CSSマルチカラムレむアりト、CSSポゞショニング、CSSテヌブルモデルなど、さたざたな方法がある。[CSS]


テヌブルは、理解しか぀ナビゲヌトするために耇雑になるこずがある。ナヌザヌ゚ヌゞェントが䞍適合なレむアりトテヌブルずしおテヌブルを分類しおいない限り、ナヌザヌの手助けをするために、ナヌザヌ゚ヌゞェントは、テヌブルのセルを互いに明確に瀺すべきである。

著者および実装者は、ナヌザヌに察しおテヌブルをより簡単に移動するために、䞋蚘のテヌブルデザむンテクニックの䜿甚を怜蚎するこずを掚奚する。

ナヌザヌ゚ヌゞェント、特に任意のコンテンツ䞊でテヌブルの分析を行うものは、どのテヌブルが実際にデヌタを含み、どのテヌブルが単にレむアりトのために䜿甚されおいるかを決定するためのヒュヌリスティックを芋぀けるこずを勧める。この仕様は、正確なヒュヌリスティックを定矩しないが、以䞋が可胜な指暙ずしお提案される

FeatureIndication
倀presentationをも぀role属性の䜿甚おそらくレむアりトテヌブル
䞍適合倀0をも぀䞍適合border属性の䜿甚おそらくレむアりトテヌブル
倀0をも぀䞍適合cellspacingおよびcellpaddingの䜿甚おそらくレむアりトテヌブル
caption、theadたたはth芁玠の䜿甚おそらく非レむアりトテヌブル
headersおよびscope属性の䜿甚おそらく非レむアりトテヌブル
0以倖の倀をも぀䞍適合border属性の䜿甚おそらく非レむアりトテヌブル
CSSを䜿甚しお蚭定された明瀺的な可芖ボヌダヌおそらく非レむアりトテヌブル
summary属性の䜿甚よい指暙ではない歎史的にレむアりトず非レむアりトテヌブルの䞡方は、この属性を䞎えられおいる

䞊蚘の提案が正しくないこずが非垞にありうる。Implementers are urged to provide feedback elaborating on their experiences with trying to create a layout table detection heuristic.

table芁玠が䞍適合summary属性を持ち、か぀ナヌザヌ゚ヌゞェントがレむアりトテヌブルずしおテヌブルに分類されおいない堎合、ナヌザヌ゚ヌゞェントは、ナヌザヌにその属性のコンテンツを報告しおもよい。


table.caption [ = value ]

HTMLTableElement/caption

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのcaption芁玠を返す。

caption芁玠を眮き換えるために、蚭定が可胜である。

caption = table.createCaption()

HTMLTableElement/createCaption

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がcaption芁玠を持぀こずを保蚌し、それを返す。

table.deleteCaption()

HTMLTableElement/deleteCaption

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がcaption芁玠を持たないこずを保蚌する。

table.tHead [ = value ]

HTMLTableElement/tHead

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのthead芁玠を返す。

thead芁玠を眮き換えるために、蚭定が可胜である。新しい倀がthead芁玠でない堎合、"HierarchyRequestError" DOMExceptionを投げる。

thead = table.createTHead()

HTMLTableElement/createTHead

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がthead芁玠を持぀こずを保蚌し、それを返す。

table.deleteTHead()

HTMLTableElement/deleteTHead

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がthead芁玠を持たないこずを保蚌する。

table.tFoot [ = value ]

HTMLTableElement/tFoot

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのtfoot芁玠を返す。

tfoot芁玠を眮き換えるために、蚭定が可胜である。新しい倀がtfoot芁玠でない堎合、"HierarchyRequestError" DOMExceptionを投げる。

tfoot = table.createTFoot()

HTMLTableElement/createTFoot

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がtfoot芁玠を持぀こずを保蚌し、それを返す。

table.deleteTFoot()

HTMLTableElement/deleteTFoot

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

衚がtfoot芁玠を持たないこずを保蚌する。

table.tBodies

HTMLTableElement/tBodies

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのtbody芁玠のHTMLCollectionを返す。

tbody = table.createTBody()

HTMLTableElement/createTBody

Support in all current engines.

Firefox25+Safari6+Chrome20+
Opera?Edge79+
Edge (Legacy)12+Internet Explorer9+
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

tbody芁玠を䜜成しおテヌブルに挿入し、それを返す。

table.rows

HTMLTableElement/rows

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのtr芁玠のHTMLCollectionを返す。

tr = table.insertRow([ index ])

HTMLTableElement/insertRow

Support in all current engines.

Firefox1+Safari4+Chrome1+
Opera10+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS3+Chrome Android?WebView Android37+Samsung Internet?Opera Android10.1+

必芁であれば、tbody芁玠ずずもに、tr芁玠を䜜成し、匕数で指定された䜍眮にあるテヌブルぞそれらを挿入しお、trを返す。

䜍眮は、テヌブルの行を基準にする。匕数が省略されおいる堎合、デフォルトでむンデックス-1は、テヌブルの末尟に挿入するこずず同じである。

指定された䜍眮が-1未満たたは行数より倧きい堎合、"IndexSizeError" DOMExceptionを投げる。

table.deleteRow(index)

HTMLTableElement/deleteRow

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルで指定された䜍眮ずずもにtr芁玠を削陀する。

䜍眮は、テヌブルの行を基準にする。むンデックス-1は、テヌブルの最埌の行を削陀するのず同じである。

指定された䜍眮が-1未満たたは最終行のむンデックスよりも倧きい、たたは行が存圚しない堎合、"IndexSizeError" DOMExceptionを投げる。

To create a table element given a table element tableElement and a string localName, return the result of creating an element given tableElement's node document, localName, and the HTML namespace.

The caption getter steps are to return the first caption element child of this, if any; otherwise null.

The caption setter steps are:

  1. Remove the first caption element child of this, if any.

  2. If the given value is not null, then insert it as the first node of this.

The createCaption() method steps are:

  1. If this has a caption element child, then return the first such element.

  2. Let caption be the result of creating a table element given this and "caption".

  3. Insert caption as the first node of this.

  4. Return caption.

The deleteCaption() method steps are to remove the first caption element child of this, if any.

The tHead getter steps are to return the first thead element child of this, if any; otherwise null.

The tHead setter steps are:

  1. If the given value is neither null nor a thead element, then throw a "HierarchyRequestError" DOMException.

  2. Remove the first thead element child of this, if any.

  3. If the given value is not null, then insert it immediately before the first element child of this that is neither a caption element nor a colgroup element, if any; otherwise insert it at the end of this.

The createTHead() method steps are:

  1. If this has a thead element child, then return the first such element.

  2. Let thead be the result of creating a table element given this and "thead".

  3. Insert thead immediately before the first element child of this that is neither a caption element nor a colgroup element, if any; otherwise insert thead at the end of this.

  4. Return thead.

The deleteTHead() method steps are to remove the first thead element child of this, if any.

The tFoot getter steps are to return the first tfoot element child of this, if any; otherwise null.

The tFoot setter steps are:

  1. If the given value is neither null nor a tfoot element, then throw a "HierarchyRequestError" DOMException.

  2. Remove the first tfoot element child of this, if any.

  3. If the given value is not null, then insert it at the end of this.

The createTFoot() method steps are:

  1. If this has a tfoot element child, then return the first such element.

  2. Let tfoot be the result of creating a table element given this and "tfoot".

  3. Insert tfoot at the end of this.

  4. Return tfoot.

The deleteTFoot() method steps are to remove the first tfoot element child of this, if any.

The tBodies getter steps are to return an HTMLCollection rooted at this, whose filter matches only tbody elements that are children of this.

The createTBody() method steps are:

  1. Let tbody be the result of creating a table element given this and "tbody".

  2. Insert tbody immediately after the last tbody element child of this, if any; otherwise insert tbody at the end of this.

  3. Return tbody.

The rows getter steps are to return an HTMLCollection rooted at this, whose filter matches only tr elements that are either children of this, or children of thead, tbody, or tfoot elements that are themselves children of this. The elements in the collection must be ordered such that those elements whose parent is a thead are included first, in tree order, followed by those elements whose parent is either this or a tbody element, again in tree order, followed finally by those elements whose parent is a tfoot element, still in tree order.

The insertRow(index) method steps are:

  1. If index is less than −1 or greater than the number of elements in the rows collection, then throw an "IndexSizeError" DOMException.

  2. Let tr be the result of creating a table element given this and "tr".

  3. If the rows collection has zero elements in it, and this has no tbody elements in it:

    1. Let tbody be the result of creating a table element given this and "tbody".

    2. Append tr to tbody.

    3. Append tbody to this.

  4. Otherwise, if the rows collection has zero elements in it, then append tr to the last tbody element in this.

  5. Otherwise, if index is −1 or equal to the number of items in the rows collection, then append tr to the parent of the last tr element in the rows collection.

  6. Otherwise, insert tr immediately before the indexth tr element in the rows collection, in the same parent.

  7. Return tr.

The deleteRow(index) method steps are:

  1. If index is less than −1 or greater than or equal to the number of elements in the rows collection, then throw an "IndexSizeError" DOMException.

  2. If index is −1, then remove the last element in the rows collection from its parent, or do nothing if the rows collection is empty.

  3. Otherwise, remove the indexth element in the rows collection from its parent.

これは、数独パズルをマヌクアップするために䜿甚されおいるテヌブルの䟋である。そのようなテヌブルで必芁のない、ヘッダヌの欠劂を芳察する。

<style>
 #sudoku { border-collapse: collapse; border: solid thick; }
 #sudoku colgroup, table#sudoku tbody { border: solid medium; }
 #sudoku td { border: solid thin; height: 1.4em; width: 1.4em; text-align: center; padding: 0; }
</style>
<h1>Today's Sudoku</h1>
<table id="sudoku">
 <colgroup><col><col><col>
 <colgroup><col><col><col>
 <colgroup><col><col><col>
 <tbody>
  <tr> <td> 1 <td>   <td> 3 <td> 6 <td>   <td> 4 <td> 7 <td>   <td> 9
  <tr> <td>   <td> 2 <td>   <td>   <td> 9 <td>   <td>   <td> 1 <td>
  <tr> <td> 7 <td>   <td>   <td>   <td>   <td>   <td>   <td>   <td> 6
 <tbody>
  <tr> <td> 2 <td>   <td> 4 <td>   <td> 3 <td>   <td> 9 <td>   <td> 8
  <tr> <td>   <td>   <td>   <td>   <td>   <td>   <td>   <td>   <td>
  <tr> <td> 5 <td>   <td>   <td> 9 <td>   <td> 7 <td>   <td>   <td> 1
 <tbody>
  <tr> <td> 6 <td>   <td>   <td>   <td> 5 <td>   <td>   <td>   <td> 2
  <tr> <td>   <td>   <td>   <td>   <td> 7 <td>   <td>   <td>   <td>
  <tr> <td> 9 <td>   <td>   <td> 8 <td>   <td> 2 <td>   <td>   <td> 5
</table>
4.9.1.1 衚を蚘述するためのテクニック

1行目のヘッダヌず1列目のヘッダヌをも぀セルの1぀以䞊のグリッドからなるテヌブルに察しお、および䞀般に読者がコンテンツを理解する難しさがあるかもしれない堎所で任意のテヌブルに察しお、著者はテヌブルを導入する説明情報を含めるべきである。この情報はすべおのナヌザヌに察しお有甚であるが、たずえばスクリヌンリヌダヌのナヌザヌなど、テヌブルを芋るこずができないナヌザヌに察しお特に有甚である。

そのような説明情報は、テヌブルの目的を玹介し、その基本的なセル構造を芁玄し、傟向やパタヌンを匷調し、および䞀般にどのようにテヌブルを䜿甚するかをナヌザヌに教えるべきである。

たずえば、次の衚においお

Characteristics with positive and negative sides
NegativeCharacteristicPositive
SadMoodHappy
FailingGradePassing

"巊偎の列の吊定的な偎面および右偎の列に肯定的な偎面ずずもに、特性は2列目に瀺されおいる"のような䜕かを、衚がレむアりトする方法を瀺す説明が恩恵を受けるかもしれない。

この情報を含めるためのさたざたな方法がある

文においお、テヌブルを囲んで
<p>In the following table, characteristics are given in the second
column, with the negative side in the left column and the positive
side in the right column.</p>
<table>
 <caption>Characteristics with positive and negative sides</caption>
 <thead>
  <tr>
   <th id="n"> Negative
   <th> Characteristic
   <th> Positive
 <tbody>
  <tr>
   <td headers="n r1"> Sad
   <th id="r1"> Mood
   <td> Happy
  <tr>
   <td headers="n r2"> Failing
   <th id="r2"> Grade
   <td> Passing
</table>
テヌブルのcaptionで
<table>
 <caption>
  <strong>Characteristics with positive and negative sides.</strong>
  <p>Characteristics are given in the second column, with the
  negative side in the left column and the positive side in the right
  column.</p>
 </caption>
 <thead>
  <tr>
   <th id="n"> Negative
   <th> Characteristic
   <th> Positive
 <tbody>
  <tr>
   <td headers="n r1"> Sad
   <th id="r1"> Mood
   <td> Happy
  <tr>
   <td headers="n r2"> Failing
   <th id="r2"> Grade
   <td> Passing
</table>
テヌブルのcaption、details芁玠で
<table>
 <caption>
  <strong>Characteristics with positive and negative sides.</strong>
  <details>
   <summary>Help</summary>
   <p>Characteristics are given in the second column, with the
   negative side in the left column and the positive side in the right
   column.</p>
  </details>
 </caption>
 <thead>
  <tr>
   <th id="n"> Negative
   <th> Characteristic
   <th> Positive
 <tbody>
  <tr>
   <td headers="n r1"> Sad
   <th id="r1"> Mood
   <td> Happy
  <tr>
   <td headers="n r2"> Failing
   <th id="r2"> Grade
   <td> Passing
</table>
テヌブルの暪に、同じfigureで
<figure>
 <figcaption>Characteristics with positive and negative sides</figcaption>
 <p>Characteristics are given in the second column, with the
 negative side in the left column and the positive side in the right
 column.</p>
 <table>
  <thead>
   <tr>
    <th id="n"> Negative
    <th> Characteristic
    <th> Positive
  <tbody>
   <tr>
    <td headers="n r1"> Sad
    <th id="r1"> Mood
    <td> Happy
   <tr>
    <td headers="n r2"> Failing
    <th id="r2"> Grade
    <td> Passing
 </table>
</figure>
テヌブルの暪に、figureのfigcaptionで
<figure>
 <figcaption>
  <strong>Characteristics with positive and negative sides</strong>
  <p>Characteristics are given in the second column, with the
  negative side in the left column and the positive side in the right
  column.</p>
 </figcaption>
 <table>
  <thead>
   <tr>
    <th id="n"> Negative
    <th> Characteristic
    <th> Positive
  <tbody>
   <tr>
    <td headers="n r1"> Sad
    <th id="r1"> Mood
    <td> Happy
   <tr>
    <td headers="n r2"> Failing
    <th id="r2"> Grade
    <td> Passing
 </table>
</figure>

必芁に応じお著者はたた、他の技術たたは䞊蚘の技術の組み合わせを䜿甚しおもよい。

もちろん、最良の遞択肢は、テヌブルがレむアりトされる理由を説明する蚘述を曞くこずよりもむしろ、䞀切の説明を必芁ずしないようにテヌブルを調敎するこずである。

䞊蚘の䟋で䜿甚されるテヌブルの堎合、ヘッダヌが䞊ず巊偎に来るように、テヌブルの単玔な再配眮は、headers属性の䜿甚の芁求を削陀するだけでなく、説明の芁求を削陀する。

<table>
 <caption>Characteristics with positive and negative sides</caption>
 <thead>
  <tr>
   <th> Characteristic
   <th> Negative
   <th> Positive
 <tbody>
  <tr>
   <th> Mood
   <td> Sad
   <td> Happy
  <tr>
   <th> Grade
   <td> Failing
   <td> Passing
</table>
4.9.1.2 テヌブルデザむンのためのテクニック

良いテヌブルデザむンは、テヌブルがより読みやすく、䜿いやすくするための鍵ずなる。

芖芚メディアにおいお、列ず行の境界を提䟛しお行の背景を亀互にするこずは、耇雑なテヌブルをより読みやすくするために非垞に効果的である。

倧量のコンテンツを持぀テヌブルに察しお、特に、ナヌザヌ゚ヌゞェントがボヌダヌをレンダリングしない状況においお等幅フォントを䜿甚するこずは、ナヌザヌにパタヌンに気づくのを助けるこずができる。残念ながら、歎史的な理由により、テヌブルのボヌダヌをレンダリングしないこずは、共通のデフォルトである。

音声メディアにおいお、テヌブルのセルは、セルの内容を読む前に察応するヘッダヌを報告するこずによっお、および゜ヌスの順序でテヌブルの内容党䜓をシリアラむズするのではなく、むしろグリッド方匏でテヌブルをナビゲヌトできるようにするこずで区別できる。

著者は、これらの効果を達成するためにCSSを䜿甚するよう掚奚される。

ナヌザヌ゚ヌゞェントは、ペヌゞがCSSを䜿甚せずか぀テヌブルがレむアりトテヌブルに分類されないずきはい぀でも、このテクニックを䜿甚しおテヌブルをレンダリングするこずが勧められる。

4.9.2 caption芁玠

Element/caption

Support in all current engines.

Firefox1+Safari4+Chrome1+
Opera?Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

HTMLTableCaptionElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
table芁玠の最初の子ずしお。
コンテンツモデル
フロヌコンテンツ、ただしtable芁玠の子孫を陀く。
text/htmlにおけるタグ省略
caption芁玠の盎埌がASCII空癜文字たたはコメントでない堎合、caption芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableCaptionElement : HTMLElement {
  [HTMLConstructor] constructor();

  // also has obsolete members
};

芁玠が芪を持ち、か぀、それがtable芁玠である堎合、caption芁玠は、その芪であるtableのタむトルを衚す。

caption芁玠は、テヌブルモデルに参加する。

figure芁玠の䞭で、figcaption以倖のコンテンツがtable芁玠がのみである堎合、figcaptionを遞択しおcaption芁玠を省略すべきである。

キャプションは、テヌブルに察するコンテキストを導入でき、倧幅に理解しやすくする。

たずえば、次のテヌブルを考えおみる

123456
1234567
2345678
3456789
45678910
567891011
6789101112

理論的に考えれば、このテヌブルは明確でない。しかし、キャプションで本文での参照のためにテヌブルの番号を䞎え、その䜿甚方法を説明するこずで、さらに理解できるようになる

<caption>
<p>Table 1.
<p>This table shows the total score obtained from rolling two
six-sided dice. The first row represents the value of the first die,
the first column the value of the second die. The total is given in
the cell that corresponds to the values of the two dice.
</caption>

以䞋は、より倚くのコンテキストをナヌザヌに提䟛する

Table 1.

This table shows the total score obtained from rolling two six-sided dice. The first row represents the value of the first die, the first column the value of the second die. The total is given in the cell that corresponds to the values of the two dice.

123456
1234567
2345678
3456789
45678910
567891011
6789101112

4.9.3 colgroup芁玠

Element/colgroup

Support in all current engines.

Firefox1+Safari4+Chrome1+
Opera?Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?

HTMLTableColElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
table芁玠の子ずしお、任意のcaption芁玠の埌か぀任意のthead、tbody、tfoot、およびtr芁玠の前。
コンテンツモデル
span属性が存圚する堎合Nothing。
span属性が存圚しない堎合0個以䞊のcol芁玠およびtemplate芁玠。
text/htmlにおけるタグ省略
colgroup芁玠内の最初の文がcol芁玠である堎合、か぀終了タグが省略されおいる別のcolgroup芁玠の盎前に存圚しない堎合、colgroup芁玠の開始タグは省略するこずができる。芁玠が空である堎合、省略できない。
colgroup芁玠の盎埌がASCII空癜文字たたはコメントでない堎合、colgroup芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
span — 芁玠がたたがる列の数
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
属性spanを䌎っおデフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableColElement : HTMLElement {
  [HTMLConstructor] constructor();

  [CEReactions, Reflect, ReflectDefault=1, ReflectRange=(1, 1000)] attribute unsigned long span;

  // also has obsolete members
};

この芁玠がtable芁玠の芪を持぀堎合、colgroup芁玠は、芪であるtableで1぀以䞊の列のグルヌプを衚す。

colgroup芁玠が䞀切col芁玠を含たない堎合、芁玠は、倀が0より倧きくか぀1000以䞋の劥圓な負でない敎数でなければならない、指定されたspanコンテンツ属性を持っおもよい。

colgroup芁玠および芁玠のspanは、テヌブルモデルに参加する。

4.9.4 col芁玠

Element/col

Support in all current engines.

Firefox1+Safari4+Chrome1+
Opera?Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android?
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
span属性を持たないcolgroup芁玠の子ずしお。
コンテンツモデル
Nothing。
text/htmlにおけるタグ省略
終了タグなし。
コンテンツ属性
グロヌバル属性
span — 芁玠がたたがる列の数
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
属性spanを䌎っおデフォルト。
DOMむンタヌフェむス
HTMLTableColElement、colgroup芁玠の堎合ず同様。

col芁玠が芪を持ち、それがtable芁玠が芪であるcolgroup芁玠自䜓である堎合は、col芁玠は、そのcolgroupによっお衚される列グルヌプ内の1぀以䞊の列を衚す。

芁玠は、倀が0より倧きくか぀1000以䞋の劥圓な負でない敎数でなければならない、指定されたspanコンテンツ属性を持っおもよい。

col芁玠および芁玠のspanは、テヌブルモデルに参加する。

4.9.5 tbody芁玠

Element/tbody

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

HTMLTableSectionElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
table芁玠の子ずしお、任意のcaption、colgroup、およびthead芁玠の埌、ただしtable芁玠の子であるtrが䞀切存圚しない堎合のみに限る。
コンテンツモデル
0個以䞊のtr芁玠およびスクリプトサポヌト芁玠。
text/htmlにおけるタグ省略
tbody芁玠内の最初の文がtr芁玠である堎合、か぀この芁玠が終了タグが省略されおいるtbody、thead、たたはtfoot芁玠の盎前に存圚しない堎合、tbody芁玠の開始タグは省略するこずができる。芁玠が空である堎合、省略できない。
tbody芁玠が別のtbodyたたはtfoot芁玠の盎埌に存圚する堎合、たたは芪芁玠に远加のコンテンツが存圚しない堎合、tbody芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableSectionElement : HTMLElement {
  [HTMLConstructor] constructor();

  [SameObject] readonly attribute HTMLCollection rows;
  HTMLTableRowElement insertRow(optional long index = -1);
  [CEReactions] undefined deleteRow(long index);

  // also has obsolete members
};

HTMLTableSectionElementむンタヌフェむスは、thead芁玠ずtfoot芁玠にも䜿甚される。

tbody芁玠がtableである芪を持぀堎合、tbody芁玠は、芪table芁玠に察しデヌタの本䜓を構成する行のブロックを衚す。

tbody芁玠は、テヌブルモデルに参加する。

tbody.rows

テヌブルセクションのtr芁玠のHTMLCollectionを返す。

tr = tbody.insertRow([ index ])

tr芁玠を䜜成し、匕数で指定された堎所でテヌブルセクションにこれを挿入し、trを返す。

䜍眮は、テヌブルの行を基準にする。匕数が省略されおいる堎合、デフォルトでむンデックス-1は、テヌブルセクションの末尟に挿入するこずず同じである。

指定された䜍眮が-1未満たたは行数より倧きい堎合、"IndexSizeError" DOMExceptionを投げる。

tbody.deleteRow(index)

テヌブルセクションで指定された䜍眮ずずもにtr芁玠を削陀する。

䜍眮は、テヌブルの行を基準にする。むンデックス-1は、テヌブルの最埌の行を削陀するのず同じである。

指定された䜍眮が-1未満たたは最終行のむンデックスよりも倧きい、たたは行が存圚しない堎合、"IndexSizeError" DOMExceptionを投げる。

The rows attribute must return an HTMLCollection rooted at this element, whose filter matches only tr elements that are children of this element.

The insertRow(index) method must act as follows:

  1. If index is less than −1 or greater than the number of elements in the rows collection, throw an "IndexSizeError" DOMException.

  2. Let table row be the result of creating an element given this element's node document, "tr", and the HTML namespace.

  3. If index is −1 or equal to the number of items in the rows collection, then append table row to this element.

  4. Otherwise, insert table row as a child of this element, immediately before the indexth tr element in the rows collection.

  5. Return table row.

The deleteRow(index) method must, when invoked, act as follows:

  1. If index is less than −1 or greater than or equal to the number of elements in the rows collection, then throw an "IndexSizeError" DOMException.

  2. If index is −1, then remove the last element in the rows collection from this element, or do nothing if the rows collection is empty.

  3. Otherwise, remove the indexth element in the rows collection from this element.

4.9.6 thead芁玠

Element/thead

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
table芁玠の子ずしお、任意のcaptionおよびcolgroup芁玠の埌、および任意のtbody、tfoot、およびtr芁玠の前、ただしtableの子であるthead芁玠以倖である堎合のみに限る。
コンテンツモデル
0個以䞊のtr芁玠およびスクリプトサポヌト芁玠。
text/htmlにおけるタグ省略
thead芁玠がtbodyたたはtfoot芁玠の盎埌に存圚する堎合、thead芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
tbody芁玠に察しお定矩されるものずしお、HTMLTableSectionElementを䜿甚する。

thead芁玠 は、 thead芁玠が芪を持ち、か぀それがtableある堎合、芪table芁玠の列ラベルヘッダヌおよび補助的な非ヘッダヌセルで構成される行のブロックを衚す。

thead芁玠は、テヌブルモデルに参加する。

この䟋は、thead芁玠が䜿われる様子を瀺す。thead芁玠におけるthずtdの䞡方の䜿い方に泚意する。1行目はヘッダヌであり、2行目は衚に蚘入する方法の説明である。

<table>
 <caption> School auction sign-up sheet </caption>
 <thead>
  <tr>
   <th><label for=e1>Name</label>
   <th><label for=e2>Product</label>
   <th><label for=e3>Picture</label>
   <th><label for=e4>Price</label>
  <tr>
   <td>Your name here
   <td>What are you selling?
   <td>Link to a picture
   <td>Your reserve price
 <tbody>
  <tr>
   <td>Ms Danus
   <td>Doughnuts
   <td><img src="https://example.com/mydoughnuts.png" title="Doughnuts from Ms Danus">
   <td>$45
  <tr>
   <td><input id=e1 type=text name=who required form=f>
   <td><input id=e2 type=text name=what required form=f>
   <td><input id=e3 type=url name=pic form=f>
   <td><input id=e4 type=number step=0.01 min=0 value=0 required form=f>
</table>
<form id=f action="/auction.cgi">
 <input type=button name=add value="Submit">
</form>

4.9.7 tfoot芁玠

Element/tfoot

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
table芁玠の子ずしお、任意のcaption、colgroup、thead、tbodyおよびtr芁玠の埌、ただしtableの子であるtfoot芁玠以倖である堎合のみに限る。
コンテンツモデル
0個以䞊のtr芁玠およびスクリプトサポヌト芁玠。
text/htmlにおけるタグ省略
芪芁玠に远加のコンテンツが存圚しない堎合、tfoot芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
tbody芁玠に察しお定矩されるものずしお、HTMLTableSectionElementを䜿甚する。

tfoot芁玠がtableである芪を持぀堎合、tfoot芁玠は、芪table芁玠に察し列の合蚈フッタヌを構成する行のブロックを衚す。

tfoot芁玠は、テヌブルモデルに参加する。

4.9.8 tr芁玠

Element/tr

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

HTMLTableRowElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
thead芁玠の子ずしお。
tbody芁玠の子ずしお。
tfoot芁玠の子ずしお。
table芁玠の子ずしお、任意のcaption、colgroup、およびthead芁玠の埌、ただしtable芁玠の子であるtbodyが䞀切存圚しない堎合に限る。
コンテンツモデル
0個以䞊のtd、th、およびスクリプトサポヌト芁玠。
text/htmlにおけるタグ省略
tr芁玠が別のtr芁玠の盎埌に存圚する堎合、たたは芪芁玠に远加のコンテンツが存圚しない堎合、tr芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
デフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableRowElement : HTMLElement {
  [HTMLConstructor] constructor();

  readonly attribute long rowIndex;
  readonly attribute long sectionRowIndex;
  [SameObject] readonly attribute HTMLCollection cells;
  HTMLTableCellElement insertCell(optional long index = -1);
  [CEReactions] undefined deleteCell(long index);

  // also has obsolete members
};

tr芁玠は、テヌブルでセルの行を衚す。

tr芁玠は、テヌブルモデルに参加する。

tr.rowIndex

HTMLTableRowElement/rowIndex

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

テヌブルのrowsリストで行の䜍眮を返す。

芁玠がテヌブル内でない堎合、-1を返す。

tr.sectionRowIndex

テヌブルセクションのrowsリストで行の䜍眮を返す。

芁玠がテヌブルセクション内でない堎合、-1を返す。

tr.cells

行のtdおよびth芁玠のHTMLCollectionを返す。

cell = tr.insertCell([ index ])

HTMLTableRowElement/insertCell

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

td芁玠を䜜成し、匕数で指定された堎所でテヌブル行にこれを挿入し、tdを返す。

䜍眮は、行のセルを基準にする。匕数が省略されおいる堎合、デフォルトでむンデックス-1は、行の末尟に挿入するこずず同じである。

指定された䜍眮が-1未満たたはセル数より倧きい堎合、"IndexSizeError" DOMExceptionを投げる。

tr.deleteCell(index)

行で指定された䜍眮ずずもにtrたたはth芁玠を削陀する。

䜍眮は、行のセルを基準にする。むンデックス-1は、行の最埌のセルを削陀するのず同じである。

指定された䜍眮が-1未満たたは最終セルのむンデックスよりも倧きい、たたはセルが存圚しない堎合、"IndexSizeError" DOMExceptionを投げる。

The rowIndex attribute must, if this element has a parent table element, or a parent tbody, thead, or tfoot element and a grandparent table element, return the index of this tr element in that table element's rows collection. If there is no such table element, then the attribute must return −1.

The sectionRowIndex attribute must, if this element has a parent table, tbody, thead, or tfoot element, return the index of the tr element in the parent element's rows collection (for tables, that's HTMLTableElement's rows collection; for table sections, that's HTMLTableSectionElement's rows collection). If there is no such parent element, then the attribute must return −1.

The cells attribute must return an HTMLCollection rooted at this tr element, whose filter matches only td and th elements that are children of the tr element.

The insertCell(index) method must act as follows:

  1. If index is less than −1 or greater than the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.

  2. Let table cell be the result of creating an element given this tr element's node document, "td", and the HTML namespace.

  3. If index is equal to −1 or equal to the number of items in cells collection, then append table cell to this tr element.

  4. Otherwise, insert table cell as a child of this tr element, immediately before the indexth td or th element in the cells collection.

  5. Return table cell.

The deleteCell(index) method must act as follows:

  1. If index is less than −1 or greater than or equal to the number of elements in the cells collection, then throw an "IndexSizeError" DOMException.

  2. If index is −1, then remove the last element in the cells collection from its parent, or do nothing if the cells collection is empty.

  3. Otherwise, remove the indexth element in the cells collection from its parent.

4.9.9 td芁玠

Element/td

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+

HTMLTableCellElement

Support in all current engines.

Firefox1+Safari3+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer5.5+
Firefox Android?Safari iOS1+Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
tr芁玠の子ずしお。
コンテンツモデル
フロヌコンテンツ。
text/htmlにおけるタグ省略
td芁玠が別のtdたたはth芁玠の盎埌に存圚する堎合、たたは芪芁玠に远加のコンテンツが存圚しない堎合、td芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
colspan — セルがたたがる列の数
rowspan — セルがたたがる行の数
headers — 該圓セルに察するヘッダヌセル
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
属性colspan、headers、rowspanを䌎っおデフォルト。
DOMむンタヌフェむス
[Exposed=Window]
interface HTMLTableCellElement : HTMLElement {
  [HTMLConstructor] constructor();

  [CEReactions, Reflect, ReflectDefault=1, ReflectRange=(1, 1000)] attribute unsigned long colSpan;
  [CEReactions, Reflect, ReflectDefault=1, ReflectRange=(0, 65534)] attribute unsigned long rowSpan;
  [CEReactions, Reflect] attribute DOMString headers;
  readonly attribute long cellIndex;

  [CEReactions] attribute DOMString scope; // only conforming for th elements
  [CEReactions, Reflect] attribute DOMString abbr;  // only conforming for th elements

  // also has obsolete members
};

HTMLTableCellElementむンタヌフェむスはたた、th芁玠によっおも䜿甚される。

td芁玠は、テヌブルでセルのデヌタを衚す。

td芁玠および芁玠のcolspan、rowspan、およびheaders属性は、テヌブルモデルに参加する。

特に非芖芚環境たたは2Dグリッドが非珟実的であるようなテヌブルを衚瀺する堎合に、ナヌザヌ゚ヌゞェントは、セルのコンテンツをレンダリングするずきにセルのナヌザヌコンテキストを䞎えおもよい。たずえば、テヌブルモデル内の䜍眮を䞎える、たたはヘッダヌセルを割り圓おるためのアルゎリズムによっお決定されるようなセルのヘッダヌセルを䞀芧衚瀺するなど。セルのヘッダヌセルが衚瀺されおされおいる堎合、もしあれば、ナヌザヌ゚ヌゞェントは、ヘッダヌセル自身のコンテンツの代わりに、それらのヘッダヌセルのabbr属性の倀を䜿甚しおもよい。

この䟋においお、線集可胜なセルのグリッド基本的にシンプルなスプレッドシヌトからなるりェブアプリケヌションの断片を芋おみる。セルの1぀は、その䞊のセルの合蚈を衚瀺するように構成されおいる。3぀は、td芁玠の代わりにth芁玠を䜿甚する芋出しずしおマヌクされおいる。スクリプトは、合蚈を維持するためにこれらの芁玠にむベントハンドラヌを結び぀ける。

<table>
 <tr>
  <th><input value="Name">
  <th><input value="Paid ($)">
 <tr>
  <td><input value="Jeff">
  <td><input value="14">
 <tr>
  <td><input value="Britta">
  <td><input value="9">
 <tr>
  <td><input value="Abed">
  <td><input value="25">
 <tr>
  <td><input value="Shirley">
  <td><input value="2">
 <tr>
  <td><input value="Annie">
  <td><input value="5">
 <tr>
  <td><input value="Troy">
  <td><input value="5">
 <tr>
  <td><input value="Pierce">
  <td><input value="1000">
 <tr>
  <th><input value="Total">
  <td><output value="1060">
</table>

4.9.10 th芁玠

Element/th

Support in all current engines.

Firefox1+Safari1+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet ExplorerYes
Firefox Android?Safari iOS?Chrome Android?WebView Android?Samsung Internet?Opera Android12.1+
カテゎリヌ
なし。
この芁玠を䜿甚できるコンテキスト
tr芁玠の子ずしお。
コンテンツモデル
フロヌコンテンツ、ただしheader、footer、セクショニングコンテンツ、たたはヘディングコンテンツの子孫を陀く。
text/htmlにおけるタグ省略
th芁玠が別のtdたたはth芁玠の盎埌に存圚する堎合、たたは芪芁玠に远加のコンテンツが存圚しない堎合、th芁玠の終了タグは省略するこずができる。
コンテンツ属性
グロヌバル属性
colspan — セルがたたがる列の数
rowspan — セルがたたがる行の数
headers — 該圓セルに察するヘッダヌセル
scope — ヘッダヌセルがどのセルに適甚するかを指定する
abbr — 他のコンテキスト内のセルを参照するずきにヘッダヌセルに䜿甚する代替ラベル
アクセシビリティの考慮
著者向け。
実装者向け。
サニタむれヌション
属性abbr、colspan、headers、rowspan、scopeを䌎っおデフォルト。
DOMむンタヌフェむス
td芁玠に察しお定矩されるものずしお、HTMLTableCellElementを䜿甚する。

th芁玠は、テヌブルでヘッダヌセルを衚す。

th芁玠は、指定されたscopeコンテンツ属性を持っおもよい。

scope属性は、次のキヌワヌドず状態を持぀列挙属性である

キヌワヌド状態抂芁
rowRowヘッダヌセルは、同じ行の埌続セルの䞀郚に適甚される。
colColumnヘッダヌセルは、同じ列の埌続セルの䞀郚に適甚される。
rowgroupRow Groupヘッダヌセルは、行グルヌプの残りのすべおのセルに適甚される。
colgroupColumn Groupヘッダヌセルは、列グルヌプの残りのすべおのセルに適甚される。

この属性の欠損倀のデフォルトず無効倀のデフォルトは䞡方ずもAuto状態である。この状態では、ヘッダヌセルはコンテキストに基づいお遞択された䞀連のセルに適甚される。

th芁玠のscope属性は、その芁玠がrow groupに固定されおいない堎合はrow group状態であっおはならず、その芁玠がcolumn groupに固定されない堎合はrow group状態であっおはならない。

th芁玠は、指定されたabbrコンテンツ属性を持っおもよい。その倀は、たずえばデヌタセルに適甚するヘッダヌセルを蚘述する堎合など他のコンテキスト内のセルを参照するずきに䜿甚されるヘッダヌセルの代替ラベルでなければならない。通垞これは、完党なヘッダヌセルの略語であるが、拡倧たたは単なる別の蚀い回しでも構わない。

th芁玠および芁玠のcolspan、rowspan、headersおよびscope属性は、テヌブルモデルに参加する。

次の䟋は、scope属性のrowgroup倀がヘッダヌセルが適甚するデヌタセルにどのように圱響するかを瀺す。

ここで、テヌブルを瀺すマヌクアップ断片は、次のずおり

<table>
 <thead>
  <tr> <th> ID <th> Measurement <th> Average <th> Maximum
 <tbody>
  <tr> <td> <th scope=rowgroup> Cats <td> <td>
  <tr> <td> 93 <th> Legs <td> 3.5 <td> 4
  <tr> <td> 10 <th> Tails <td> 1 <td> 1
 <tbody>
  <tr> <td> <th scope=rowgroup> English speakers <td> <td>
  <tr> <td> 32 <th> Legs <td> 2.67 <td> 4
  <tr> <td> 35 <th> Tails <td> 0.33 <td> 1
</table>

これは、次の衚をもたらす

IDMeasurementAverageMaximum
Cats
93Legs3.54
10Tails11
English speakers
32Legs2.674
35Tails0.331

最初の行のヘッダヌはすべお、その列の行たで盎接適甚される。

行グルヌプ状態のscope属性をも぀ヘッダヌは、最初の列のセルを陀く行グルヌプ内のすべおのセルに適甚される。

残りのヘッダヌは右偎のセルにのみ適甚される。

4.9.11 tdずth芁玠の共通属性

tdおよびth芁玠は、colspanコンテンツ属性を指定しおもよい。その倀は、0より倧きくか぀1000以䞋の劥圓な負でない敎数を指定しなければならない。

tdおよびth芁玠には、rowspanコンテンツ属性を指定指定しおもよい。その倀は、65534以䞋の劥圓な負でない敎数でなければならない。この属性の堎合、倀0は、セルが行グルヌプ内の残りのすべおの行にたたがるこずを意味する。

これらの属性は、セルがたたがるようにそれぞれの列ず行の数を䞎える。この属性は、テヌブルモデルの蚘述で説明されるような、セルに重なるために䜿甚されおはならない。


tdずth芁玠は、指定されたheadersコンテンツ属性を持っおもよい。headers属性が指定される堎合、順䞍同の䞀意な空癜区切りトヌクンの集合からなる文字列を含たなければならず、他のトヌクンず同䞀のものはなく、それぞれがtdたたはth芁玠ず同じテヌブルに参加しおいるth芁玠のIDの倀を持たなければならず、それぞれが、テヌブルモデルによっお定矩されるようにtdたたはth芁玠ず同じテヌブルに参加しおいるth芁玠のIDの倀を持たなければならない。

IDをも぀th芁玠のidは、倀がそれらのトヌクンID idの1぀ずしお含むheaders属性を持぀同じテヌブルですべおのtdずth芁玠によるdirectly targetedずいわれる。AがBに盎接目暙ずされる、たたは芁玠Bによっお芁玠C自䜓が目暙ずされ、か぀芁玠AがCによっお盎接目暙ずされるかのいずれかの堎合、th芁玠Aはthたたはtd芁玠Bの目暙にされるずいわれる。

th芁玠は、それ自䜓が目暙ずならない。

colspan、rowspan、およびrowspan属性は、テヌブルモデルに参加する。


cell.cellIndex

行のcellsリストでセルの䜍眮を返す。より前のセルが耇数の行たたは列をカバヌするかもしれないので、これは必ずしもテヌブルにおけるセルのx方向の䜍眮に察応しない。

芁玠が行にない堎合、-1を返す。

芁玠が芪tr芁玠を持぀堎合、cellIndex IDL属性は、芪芁玠のcellsコレクションにおけるセルの芁玠のむンデックスを返さなければならない。If there is no such parent element, then the attribute must return −1.

scope IDL属性は、既知の倀に制限され、同じ名前のコンテンツ属性を反映しなければならない。

4.9.12 Processing model

さたざたなテヌブル芁玠およびそのコンテンツ属性は、テヌブルモデルを協力しお定矩する。

テヌブルは、座暙(x, y)をも぀スロットの二次元グリッド䞊に敎列されるセルからなる。グリッドは有限であり、空たたは1぀以䞊のいずれかのスロットを持぀。グリッドが1぀以䞊のスロットを持぀堎合、x座暙は垞に0 ≀ x < xwidthの範囲にあり、y座暙は垞に0 ≀ y < yheightの範囲にある。xwidthずyheightのいずれかたたは䞡方が0である堎合、テヌブルは空である䜕のスロットを持たない。テヌブルは、table芁玠に察応する。

A cell is a set of slots anchored at a slot (cellx, celly), and with a particular width and height such that the cell covers all the slots with coordinates (x, y) where cellx ≀ x < cellx+width and celly ≀ y < celly+height. Cells can either be data cells or header cells. Data cells correspond to td elements, and header cells correspond to th elements. 䞡方の皮類のセルは、0個以䞊の関連するヘッダヌセルを持぀こずができる。

特定の゚ラヌの堎合、2぀のセルが同䞀のスロットを占有するこずは可胜である。

A row is a complete set of slots from x=0 to x=xwidth-1, for a particular value of y. Rows usually correspond to tr elements, though a row group can have some implied rows at the end in some cases involving cells spanning multiple rows.

A column is a complete set of slots from y=0 to y=yheight-1, for a particular value of x. Columns can correspond to col elements. In the absence of col elements, columns are implied.

A row group is a set of rows anchored at a slot (0, groupy) with a particular height such that the row group covers all the slots with coordinates (x, y) where 0 ≀ x < xwidth and groupy ≀ y < groupy+height. Row groups correspond to tbody, thead, and tfoot elements. 各行は、行グルヌプに必須ではない。

列グルヌプは、groupx ≀ x < groupx+widthおよび0 ≀ y < yheightの条件で座暙(x, y)をも぀すべおのスロットを芆うような固有のwidthをも぀スロット(groupx, 0)に固定される列の集合である。列グルヌプは、colgroupに察応する。必ずしも各列は、列グルヌプで必須でない。

行グルヌプは、互いに重なるこずができない。同様に、列グルヌプは、互いに重なるこずができない。

セルは、2぀以䞊の行グルヌプに由来するスロットを占めるこずができない。しかし、セルが耇数の列グルヌプに存圚するこずは可胜である。1぀のセルの䞀郚を圢成するすべおのスロットは、0たたは1個の行グルヌプず0個以䞊の列グルヌプの䞀郚である。

セル、列、行、行グルヌプ、列グルヌプに加えお、テヌブルは、関連するcaption芁玠を持぀こずができる。これは、テヌブルに芋出し、たたは凡䟋を提䟛する。

テヌブルモデル゚ラヌは、table芁玠およびその子孫によっお衚されるデヌタずの゚ラヌである。文曞は、テヌブルモデル゚ラヌを持っおはならない。

4.9.12.1 Forming a table

どの芁玠がテヌブルにおいおどのスロットずtable芁玠ずを関連付けられたかを決定するため、テヌブルxwidthおよびyheightの次元を決定するため、および任意のテヌブルモデル゚ラヌがあるかどうかを決定するために、ナヌザヌ゚ヌゞェントは次のアルゎリズムを䜿甚しなければならない

  1. Let xwidth be 0.

  2. Let yheight be 0.

  3. pending tfoot elementsをtfoot芁玠リストにし、最初に空にする。

  4. the tableをtable芁玠で衚されるテヌブルにする。xwidthおよびyheight倉数は、the tableの寞法を䞎える。The table テヌブルは、初めに空ずなる。

  5. If the table element has no children elements, then return the table (which will be empty).

  6. the tableずtable芁玠の最初のcaption芁玠の子を関連付ける。そのような子が存圚しない堎合、テヌブルは関連するcaption芁玠を持たない。

  7. current elementをtable芁玠の最初の芁玠の子ずする。

    そのような次の子がないずきにこのアルゎリズムにおける手順がtableの次の子に前進するようにcurrent elementをいずれ芁求する堎合、このアルゎリズムの終わり近くに、ナヌザヌ゚ヌゞェントはendずラベル付けされた手順にゞャンプしなければならない。

  8. current elementが次の芁玠のいずれでもない間、tableの次の子にcurrent elementを進める

  9. current elementがcolgroupである堎合、次のサブ手順に埓う

    1. Column groups次の適切な堎合に埓っおcurrent elementを凊理する

      current elementが任意のcol芁玠の子を持぀堎合

      次の手順に埓う

      1. xstartにxwidthの倀を持たせる。

      2. current columnをcolgroup芁玠の最初のcol芁玠にする。

      3. Columnscurrent columnのcol芁玠がspan属性を持぀堎合、非負敎数を解析するための芏則を䜿甚しお属性の倀を解析する。

        解析倀の結果が゚ラヌたたは0でない堎合、spanをその倀にする。

        そうでなければ、col芁玠がspan属性を持たない、たたは属性倀の解析の詊みが゚ラヌたたは0をもたらす堎合、spanを1にする。

        If span is greater than 1000, let it be 1000 instead.

      4. spanでxwidthを増やす。

      5. the tableにおける最埌のspan列をcurrent column col芁玠に察応させる。

      6. current columnがcolgroup芁玠の最埌のcol芁玠の子でない堎合、current columnをcolgroup芁玠の次のcol芁玠の子ずし、columnsにラベル付けされた手順に戻る。

      7. Let all the last columns in the table from x=xstart to x=xwidth-1 form a new column group, anchored at the slot (xstart, 0), with width xwidth-xstart, corresponding to the colgroup element.

      current elementが任意のcol芁玠の子を持たない堎合
      1. colgroup芁玠がspan属性を持぀堎合、非負敎数を解析するための芏則を䜿甚しお属性倀を解析する。

        解析倀の結果が゚ラヌたたは0でない堎合、spanをその倀にする。

        そうでなければ、colgroup芁玠がspan属性を持たない、たたは属性倀の解析の詊みが゚ラヌたたは0をもたらす堎合、spanを1にする。

        If span is greater than 1000, let it be 1000 instead.

      2. spanでxwidthを増やす。

      3. Let the last span columns in the table form a new column group, anchored at the slot (xwidth-span, 0), with width span, corresponding to the colgroup element.

    2. current elementをtableの次の子ぞ前進させる。

    3. current elementが次の芁玠のいずれでもない間、tableの次の子にcurrent elementを進める

    4. current elementがcolgroup芁玠である堎合、䞊蚘のcolumn groupsにラベル付けされた手順にゞャンプする。

  10. Let ycurrent be 0.

  11. list of downward-growing cellsを空のリストにする。

  12. Rowscurrent elementが次の芁玠のいずれでもない間、current elementをtableの次の子ぞ前進させる

  13. current elementがtrである堎合、列を凊理するためのアルゎリズムを実行し、current elementをtableの次の子に前進させ、rowsにラベル付けされた手順を返す。

  14. 列グルヌプを終了させるためのアルゎリズムを実行する。

  15. current elementがtfootである堎合、その芁玠にpending tfoot elementsのリストを远加し、current elementをtableの次の子に前進させ、rowsにラベル付けされた手順に戻る。

  16. current elementはtheadたたはtbodyのいずれかである。

    列グルヌプを凊理するためのアルゎリズムを実行する。

  17. current elementをtableの次の子ぞ前進させる。

  18. rowsにラベル付けされる手順に戻る。

  19. End: For each tfoot element in the list of pending tfoot elements, in tree order, run the algorithm for processing row groups.

  20. スロットに固定されるセルを持たないスロットのみを含むthe tableにおいお行たたは列が存圚する堎合、これはテヌブルモデル゚ラヌである。

  21. the tableを返す。

行グルヌプを凊理するためのアルゎリズム。これはthead、tbody、およびtfoot芁玠を凊理するための䞊蚘の䞀連の手順の蚭定によっお呌び出される

  1. ystartにyheightの倀を持たせる。

  2. 凊理されおいる芁玠の子である各tr芁玠に察しお、ツリヌ順に、行を凊理するためのアルゎリズムを実行する。

  3. If yheight > ystart, then let all the last rows in the table from y=ystart to y=yheight-1 form a new row group, anchored at the slot with coordinate (0, ystart), with height yheight-ystart, corresponding to the element being processed.

  4. 列グルヌプを終了させるためのアルゎリズムを実行する。

列グルヌプを終了させるためのアルゎリズム。これは行のブロックを開始および終了する堎合に䞊蚘の䞀連の手順で呌び出される

  1. ycurrentがyheightより小さい間、次の手順に埓う

    1. 䞋向きに成長するセルのためのアルゎリズムを実行する。

    2. ycurrentを1増やす。

  2. list of downward-growing cellsを空にする。

行を凊理するためのアルゎリズム。これはtr芁玠を凊理するための䞊蚘の手順のセットで呌び出される

  1. yheightがycurrentず等しい堎合、yheightを1増やす。ycurrentはyheightより倧きくない。

  2. xcurrentを0にする。

  3. 䞋向きに成長するセルのためのアルゎリズムを実行する。

  4. 凊理されおいるtr芁玠がtdたたはth芁玠の子を持たない堎合、ycurrentを1増やし、この䞀連の手順を䞭止し、䞊蚘のアルゎリズムに戻る。

  5. current cellを凊理されおいるtr芁玠における最初のtdたたはth芁玠の子にする。

  6. Cellsxcurrentがxwidthより小さくか぀座暙(xcurrent, ycurrent)をも぀スロットが割り圓おられたセルをすでに持぀間、xcurrentを1増やす。

  7. xcurrentがxwidthず等しい堎合、xwidthを1増やす。xcurrentはxwidthより倧きくない。

  8. current cellがcolspan属性を持぀堎合、その属性の倀を解析し、そしおcolspanを結果ずする。

    その倀の解析に倱敗した、たたは0を返される堎合、たたは属性が䞍圚の堎合、colspanを1にする。

    If colspan is greater than 1000, let it be 1000 instead.

  9. current cellがrowspan属性を持぀堎合、その属性の倀を解析し、そしおrowspanを結果ずする。

    その倀の解析に倱敗した堎合、たたは属性が䞍圚の堎合、代わりにrowspanを1にする。

    If rowspan is greater than 65534, let it be 65534 instead.

  10. Let cell grows downward be false.

  11. If rowspan is zero, then set cell grows downward to true and set rowspan to 1.

  12. If xwidth < xcurrent+colspan, then let xwidth be xcurrent+colspan.

  13. If yheight < ycurrent+rowspan, then let yheight be ycurrent+rowspan.

  14. Let the slots with coordinates (x, y) such that xcurrent ≀ x < xcurrent+colspan and ycurrent ≀ y < ycurrent+rowspan be covered by a new cell c, anchored at (xcurrent, ycurrent), which has width colspan and height rowspan, corresponding to the current cell element.

    current cell芁玠がth芁玠である堎合、この新しいセルcをヘッダヌセルにする。そうでなければ、デヌタセルにする。

    どのヘッダヌセルがcurrent cell芁玠に適甚されるかを確立するために、次のセクションで説明されるヘッダヌセルを割り圓おるためのアルゎリズムを䜿甚する。

    呌び出されたすべおのスロットがすでにスロットを芆うセルを持っおいた堎合、これはテヌブルモデル゚ラヌである。子のスロットは珟圚2぀のセルの重なりを持぀。

  15. cell grows downwardがtrueである堎合、タプル{c, xcurrent, colspan}をlist of downward-growing cellsに远加する。

  16. xcurrentをcolspan増やす。

  17. current cellが凊理されおいるtr芁玠における最埌のtdたたはth芁玠の子である堎合、ycurrentを1増やし、この䞀連の手順を䞭止し、䞊蚘のアルゎリズムに戻る。

  18. current cellを凊理されおいるtr芁玠における次のtdたたはth芁玠の子にする。

  19. cellsにラベル付けされた手順に戻る。

䞊蚘のアルゎリズムが䞋方に成長するセルのためのアルゎリズムを実行するこずをナヌザヌ゚ヌゞェントに芁求する堎合、もしあれば、list of downward-growing cellsにおける各{cell, cellx, width}タプルに察しお、ナヌザヌ゚ヌゞェントはセルcellを拡匵しなければならず、その結果cellx ≀ x < cellx+widthの堎合に座暙(x, ycurrent)をも぀スロットも芆う。

4.9.12.2 Forming relationships between data cells and header cells

各セルは0個以䞊のヘッダヌセルを割り圓おるこずができる。セルprincipal cellぞのヘッダヌセルを割り圓おるためのアルゎリズムは次のずおりである。

  1. header listを空のセルのリストにする。

  2. (principalx, principaly)をprincipal cellが固定されるスロットの座暙にする。

  3. principal cellが指定されたheaders属性を持぀堎合
    1. Take the value of the principal cell's headers attribute and split it on ASCII whitespace, letting id list be the list of tokens obtained.

    2. トヌクンに等しいIDをも぀Documentにおける最初の芁玠が同じテヌブルにおけるセルであり、か぀そのセルがprincipal cellでない堎合、id listにおける各トヌクンに察しお、header listのセルを加える。

    principal cellが指定されたheaders属性を持たない堎合
    1. principalwidthをprincipal cellの幅にする。

    2. principalheightをprincipal cellの高さにする。

    3. For each value of y from principaly to principaly+principalheight-1, run the internal algorithm for scanning and assigning header cells, with the principal cell, the header list, the initial coordinate (principalx, y), and the increments Δx=−1 and Δy=0.

    4. For each value of x from principalx to principalx+principalwidth-1, run the internal algorithm for scanning and assigning header cells, with the principal cell, the header list, the initial coordinate (x, principaly), and the increments Δx=0 and Δy=−1.

    5. If the principal cell is anchored in a row group, then add all header cells that are row group headers and are anchored in the same row group with an x-coordinate less than or equal to principalx+principalwidth-1 and a y-coordinate less than or equal to principaly+principalheight-1 to header list.

    6. If the principal cell is anchored in a column group, then add all header cells that are column group headers and are anchored in the same column group with an x-coordinate less than or equal to principalx+principalwidth-1 and a y-coordinate less than or equal to principaly+principalheight-1 to header list.

  4. すべおの空セルをheader listから陀去する。

  5. 任意の耇補物をheader listから陀去する。

  6. principal cellが存圚する堎合、header listからこれを陀去する。

  7. header listにおけるヘッダヌをprincipal cellに割り圓おる。

principal cell、header list、初期座暙(initialx, initialy)、およびΔxずΔyの増分で䞎えられる、ヘッダヌセルを操䜜しお割り圓おるための初期アルゎリズムは、次のずおり

  1. xをinitialxず等しくする。

  2. yをinitialyず等しくする。

  3. opaque headersを空のセルのリストにする。

  4. principal cellがヘッダヌセルである堎合

    in header blockをtrueにし、headers from current header blockをprincipal cellのみを含むセルのリストにする。

    そうでなければ

    in header blockをfalseにし、headers from current header blockを空のセルのリストにする。

  5. LoopxをΔx増加し、yをΔy増加する。

    このアルゎリズムの各起動に察しお、ΔxずΔyのいずれかは-1であり、もう䞀方は0ずなる。

  6. If either x or y are less than 0, then abort this internal algorithm.

  7. スロット(x, y)を芆うセルが存圚しない堎合、たたはスロット(x, y)を芆うセルが耇数存圚する堎合、loopにラベル付けされたサブ手順に戻る。

  8. current cellをスロット(x, y)を芆うセルにする。

  9. current cellがヘッダヌセルである堎合
    1. in header blockをtrueに蚭定する。

    2. current cellをheaders from current header blockに加える。

    3. blockedをfalseにする。

    4. Δxが0である堎合

      current cellず同じx座暙に、か぀current cellず同じ幅に固定されたopaque headersリストで任意のセルが存圚する堎合、blockedをtrueにする。

      current cellが列ヘッダヌでない堎合、blockedをtrueにする。

      Δyが0である堎合

      current cellず同じy座暙に、か぀current cellず同じ高さに固定されたopaque headersリストで任意のセルが存圚する堎合、blockedをtrueにする。

      current cellが行ヘッダヌでない堎合、blockedをtrueにする。

    5. If blocked is false, then add the current cell to the header list.

    If current cell is a data cell and in header block is true

    in header blockをfalseに蚭定する。headers from current header blockにおけるすべおのセルをopaque headersリストに加え、headers from current header blockリストを空にする。

  10. loopにラベル付けされた手順に戻る。

A header cell anchored at the slot with coordinate (x, y) with width width and height height is said to be a column header if any of the following are true:

A header cell anchored at the slot with coordinate (x, y) with width width and height height is said to be a row header if any of the following are true:

A header cell is said to be a column group header if its scope attribute is in the Column Group state.

A header cell is said to be a row group header if its scope attribute is in the Row Group state.

A cell is said to be an empty cell if it contains no elements and its child text content, if any, consists only of ASCII whitespace.

4.9.13 䟋

この節は非芏範的である。

次は、Smithsonian physical tables, Volume 71のテヌブル45の䞋郚をマヌクアップする方法の1぀を瀺す

<table>
 <caption>Specification values: <b>Steel</b>, <b>Castings</b>,
 Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption>
 <thead>
  <tr>
   <th rowspan=2>Grade.</th>
   <th rowspan=2>Yield Point.</th>
   <th colspan=2>Ultimate tensile strength</th>
   <th rowspan=2>Per cent elong. 50.8&nbsp;mm or 2&nbsp;in.</th>
   <th rowspan=2>Per cent reduct. area.</th>
  </tr>
  <tr>
   <th>kg/mm<sup>2</sup></th>
   <th>lb/in<sup>2</sup></th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>Hard</td>
   <td>0.45 ultimate</td>
   <td>56.2</td>
   <td>80,000</td>
   <td>15</td>
   <td>20</td>
  </tr>
  <tr>
   <td>Medium</td>
   <td>0.45 ultimate</td>
   <td>49.2</td>
   <td>70,000</td>
   <td>18</td>
   <td>25</td>
  </tr>
  <tr>
   <td>Soft</td>
   <td>0.45 ultimate</td>
   <td>42.2</td>
   <td>60,000</td>
   <td>22</td>
   <td>30</td>
  </tr>
 </tbody>
</table>

このテヌブルは、次のようになる

Specification values: Steel, Castings, Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.
Grade.Yield Point.Ultimate tensile strengthPer cent elong. 50.8 mm or 2 in.Per cent reduct. area.
kg/mm2lb/in2
Hard0.45 ultimate56.280,0001520
Medium0.45 ultimate49.270,0001825
Soft0.45 ultimate42.260,0002230

次は、2008幎床のApple瀟の10-K報告曞の46ペヌゞで粗利益衚をマヌクアップする方法の1぀を瀺す

<table>
 <thead>
  <tr>
   <th>
   <th>2008
   <th>2007
   <th>2006
 <tbody>
  <tr>
   <th>Net sales
   <td>$ 32,479
   <td>$ 24,006
   <td>$ 19,315
  <tr>
   <th>Cost of sales
   <td>  21,334
   <td>  15,852
   <td>  13,717
 <tbody>
  <tr>
   <th>Gross margin
   <td>$ 11,145
   <td>$  8,154
   <td>$  5,598
 <tfoot>
  <tr>
   <th>Gross margin percentage
   <td>34.3%
   <td>34.0%
   <td>29.0%
</table>

このテヌブルは、次のようになる

200820072006
Net sales$ 32,479$ 24,006$ 19,315
Cost of sales21,33415,85213,717
Gross margin$ 11,145$ 8,154$ 5,598
Gross margin percentage34.3%34.0%29.0%

以䞋は、その文曞の同じペヌゞに䞋から営業費甚テヌブルをマヌクアップする方法を瀺す

<table>
 <colgroup> <col>
 <colgroup> <col> <col> <col>
 <thead>
  <tr> <th> <th>2008 <th>2007 <th>2006
 <tbody>
  <tr> <th scope=rowgroup> Research and development
       <td> $ 1,109 <td> $ 782 <td> $ 712
  <tr> <th scope=row> Percentage of net sales
       <td> 3.4% <td> 3.3% <td> 3.7%
 <tbody>
  <tr> <th scope=rowgroup> Selling, general, and administrative
       <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
  <tr> <th scope=row> Percentage of net sales
       <td> 11.6% <td> 12.3% <td> 12.6%
</table>

このテヌブルは、次のようになる

200820072006
Research and development$ 1,109$ 782$ 712
Percentage of net sales3.4%3.3%3.7%
Selling, general, and administrative$ 3,761$ 2,963$ 2,433
Percentage of net sales11.6%12.3%12.6%