Html 我';我在展示这张桌子时做错了吗?

Html 我';我在展示这张桌子时做错了吗?,html,html-table,Html,Html Table,也许这是件蠢事,但我看不出来。有什么问题 <html> <body> <form action="search" method="get"> <input> <input name="action" value="search" type="submit"> </form> <table border="1"> <thead> <th> &

也许这是件蠢事,但我看不出来。有什么问题

<html>
<body>
<form action="search" method="get">
    <input>
    <input name="action" value="search" type="submit">
</form>

<table border="1">
    <thead>
    <th>
        <td>Name</td>

    </th>
    </thead>
    <tbody>

    <tr>
        <td>Smith        </td>

    </tr>

    <tr>
        <td>Smith2        </td>
        </tr>

    </tbody>
</table>
</body>
</html>

名称
史密斯
史密斯2

“Smith”不显示在“Name”单元格下。

这是问题的根源。这样放置它们会给你一个你所期待的专栏

<tr>
    <th>Name</th>
</tr>

名称
标签是“表格标题”,您需要将它们放在tr的“表格行”中


名称


名称

您不需要将放在内,并将其包裹在中,您需要:

<tr>
    <th>
        Name
    </th>
</tr>

名称
执行以下操作:

<thead>

<tr>
<th>
 Name
</th>
</tr>

</thead>

名称
它与任何列()一样,但具有不同的默认属性(粗体文本、居中对齐文本)。因此它必须嵌套在一行中()

修复您的THead元素:

<thead>
  <tr>
    <th>Name</th>
  </tr>
</thead>

名称

名称
替换为:

<tr>
  <th>Name</th>
</tr>

名称

这里有一些关于table的精彩而新鲜的帖子,解释了所有必须看到的内容:)

您可能应该描述一下您希望这段代码做什么,而不是它现在正在做什么。光有这个密码是不够的,伙计,我不相信你们的反应有多快。我不相信。忘了其他论坛吧。StackoverFLow是最好的,不用谢我。支付乔尔·斯波尔斯基:-。
<thead>
  <tr>
    <th>Name</th>
  </tr>
</thead>
<th>
  <td>Name</td>
</th>
<tr>
  <th>Name</th>
</tr>