我的表格只有几行。我希望将第一行和第三行的高度设置为 1 px,将第二行设置为正常高度。但是我的代码不起作用。
HTML 代码在下面
<table border="0">
<tr style="height:2px;" >
<td width="10"><hr></td>
</tr>
<tr style="height:20px;" >
<td width="10">Hello</td>
</tr>
<tr style="height:20px;" >
<td width="10"><hr></td>
</tr>
</table>
谁能告诉我怎么做?
注意:我不想使用边框,因为我想要某些行,我可能需要也可能不需要行内的水平线。
最佳答案
将 style="padding:0px; margin:0px;"
添加到您的 hr
并更改您的第三个 的
到 height
tr2px
你将拥有:
<table border="0">
<tr style="height:2px;" >
<td width="10px"><hr style="padding:0px; margin:0px;"></td>
</tr>
<tr style="height:20px;" >
<td width="10px">Hello</td>
</tr>
<tr style="height:2px;" >
<td width="10px"><hr style="padding:0px; margin:0px;"></td>
</tr>
</table>
关于html - 降低 HTML 表格行高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20251656/