Validación (HTML5):El elemento 'th' no se pueden anidar en el elemento 'table'
-
21-12-2019 - |
Pregunta
Dado el siguiente código HTML, ¿por qué sale el error:
Validación (HTML5):El elemento 'th' no se pueden anidar en el elemento 'table'
<table>
<th>ID</th>
<th>text header</th>
<tr>
<td>7</td>
<td>text</td>
</tr>
</table>
Solución
Usted no puede tener el <th>
elemento fuera de un <tr>
, el siguiente fragmento de código es válido
<table>
<tr>
<th>ID</th>
<th>text header</th>
</tr>
<tr>
<td>7</td>
<td>text</td>
</tr>
</table>
<th> Contexto de uso https://developer.mozilla.org/en/docs/Web/HTML/Element/th
Permitido padre elementos
Un
<tr>
elemento.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow