gpt4 book ai didi

html - 如何在表格中正确插入
和 ?

转载 作者:搜寻专家 更新时间:2023-10-31 08:10:25 25 4
gpt4 key购买 nike

我在网上查了没找到答案,所以才来问这个问题。

新数据将始终按照以下格式进行格式化,并填充到 id="content"

<tr>
<td>name</td>
<td>age</td>
<td>gender</td>
</tr>

我读到你需要 <div><td> 里面如果你要放<div><table> 里面.现在,格式不正确。所有新数据都在第一列,而不是每一行。

<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<div id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</div>
<td>
</table>

最佳答案

更新

重新阅读您最可能需要的结构

<table>
<thead>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
</thead>
<tbody id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</tbody>
</table>

原始答案

您不能将 tr 作为 div 的直接子级。

你需要使用表格

要么

<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<table id="contents">
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</table>
<td>
</table>

<table>
<tr>
<th>name</th>
<th>age</th>
<th>gender</th>
</tr>
<td>
<div id="contents">
<table>
<tr>
<td>John</td>
<td>12</td>
<td>male</td>
</tr>
<tr>
<td>Jess</td>
<td>13</td>
<td>female</td>
</tr>
</table>
</div>
<td>
</table>

关于html - 如何在表格中正确插入 <div> 和 <tr>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28867001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com