HTML 表格问题

发布于 2024-12-11 09:45:47 字数 735 浏览 0 评论 0原文

我有一个主表,然后每个 td 插入子表。就像下面的问题是,假设我有:

<table id = "main>
<tr>
<th id = "header1">blah</td>
<th id = "header2">blah</td>
<th id = "header3">blah</td>
</tr>
<tr><td>
<table id = "sub1">
<tr><td headers='header1'>1</td></tr>
</table>
</td>
<td>
<table id = "sub2">
<tr><td headers='header2'>2</td></tr>
</table>
</td>
<td>
<table id = "sub3">
<tr><td headers='header3'>3</td></tr>
</table>
</td>
</tr>
</table>

现在,如果 sub1 只有 4 行,但 sub 2 和 3 各有 100 行,则表会将 sub1 表放在表的其余部分的中间。我该如何阻止它这样做?

I have a main table and then insert sub tables each td. Like below The problem is lets say I have:

<table id = "main>
<tr>
<th id = "header1">blah</td>
<th id = "header2">blah</td>
<th id = "header3">blah</td>
</tr>
<tr><td>
<table id = "sub1">
<tr><td headers='header1'>1</td></tr>
</table>
</td>
<td>
<table id = "sub2">
<tr><td headers='header2'>2</td></tr>
</table>
</td>
<td>
<table id = "sub3">
<tr><td headers='header3'>3</td></tr>
</table>
</td>
</tr>
</table>

now if sub1 has only 4 rows in it but sub 2 and 3 each have 100 rows the table keeps putting sub1 table in the middle of the rest of the table. How would i stop it from doing that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

撕心裂肺的伤痛 2024-12-18 09:45:47

试试这个:

<td valign="top">

您必须指定在哪里对齐 td 的内容

Try this:

<td valign="top">

You have to specify, where to align the content of td

染年凉城似染瑾 2024-12-18 09:45:47

查看valign

<td valign='top'>

更新源

<table id = "main>
<tr>
<th id = "header1">blah</td>
<th id = "header2">blah</td>
<th id = "header3">blah</td>
</tr>
<tr><td valign='top'>
<table id = "sub1">
<tr><td headers='header1'>1</td></tr>
</table>
</td>
<td>
<table id = "sub2">
<tr><td headers='header2'>2</td></tr>
</table>
</td>
<td>
<table id = "sub3">
<tr><td headers='header3'>3</td></tr>
</table>
</td>
</tr>
</table>

Look in to valign

<td valign='top'>

Updated source

<table id = "main>
<tr>
<th id = "header1">blah</td>
<th id = "header2">blah</td>
<th id = "header3">blah</td>
</tr>
<tr><td valign='top'>
<table id = "sub1">
<tr><td headers='header1'>1</td></tr>
</table>
</td>
<td>
<table id = "sub2">
<tr><td headers='header2'>2</td></tr>
</table>
</td>
<td>
<table id = "sub3">
<tr><td headers='header3'>3</td></tr>
</table>
</td>
</tr>
</table>
只有影子陪我不离不弃 2024-12-18 09:45:47

如果您增加/减少数量。表中的行/列数,您可能需要通过 rowspan 和 colspan 属性进行相同的调整。在任何单元格顶部显示文本也需要 valign="top" 属性

If you are increasing/decreasing the no. of rows/cols in your tables, you may need to adust the same through rowspan and colspan properties. Also displaying text at the top of any cell needs valign="top" property

小忆控 2024-12-18 09:45:47

制作第二个表格行(标题行之后)开始标记 。这将起作用,并且不需要 rowspan 或 colspan。

Make the second table row (after the header row) opening tag <tr style="vertical-align:top">. That will work and there is no need for rowspan or colspan.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文