HTML 表格问题
我有一个主表,然后每个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
试试这个:
您必须指定在哪里对齐 td 的内容
Try this:
You have to specify, where to align the content of td
查看valign
更新源
Look in to valign
Updated source
如果您增加/减少数量。表中的行/列数,您可能需要通过 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制作第二个表格行(标题行之后)开始标记
。这将起作用,并且不需要 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.