検証(HTML5):要素 'th'を要素 'table'にネストすることはできません

StackOverflow https://stackoverflow.com//questions/24024933

  •  21-12-2019
  •  | 
  •  

質問

次のHTMLを考慮すると、なぜエラーが発生します。

検証(HTML5):要素 'th'を要素の 'table'

にネストできません
<table>
    <th>ID</th>
    <th>text header</th>
    <tr>
        <td>7</td>
        <td>text</td>
    </tr>
</table>
.

役に立ちましたか?

解決

<th>の外側に<tr>要素を持つことはできません。次のスニペットは有効です

<table>
    <tr>
        <th>ID</th>
        <th>text header</th>
    </tr>
    <tr>
        <td>7</td>
        <td>text</td>
    </tr>
</table>
.

<>使用状況コンテキスト HTTPS://developer.mozilla.org/en/docs/web/html/element/th

許可親要素

<tr>要素

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top