问题是针对 TH 标签提出的,但我找不到针对 TD 标签的问题。
我可以把标题放在里面吗 <td>
标签?
最佳答案
thead
不是 h3
,如果你在 td
元素中使用 h3
,那绝对没问题,但是如果您使用 h3
作为 tr
的直接子级是无效的。
为了使用thead
,你可以像这样使用它
<table>
<thead>
<tr>
<th>This is table head and not h3</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Foot Cell</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>
<h3>It's completely valid to put your h3 here</h3>
Table cell
<p>You can also use p tag here
</td>
</tr>
</tbody>
</table>
但是如果你这样做的话,是无效的
<罢工>罢工>
<罢工><table>
<tr>
<h3>It's invalid</h3>
<td>This is a cell</td>
</tr>
</table>
罢工><罢工>罢工>
您可以随时查看here您的标记是否有效。
关于html - 将 h3(或任何标题)放在 td 标签内是否有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19268914/