我有几行的表.我希望第1和第3行高度设置为1 px,第2行设置为正常高度.但我的代码不起作用.
HTML CODE如下
<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>
Run Code Online (Sandbox Code Playgroud)
谁能告诉我怎么做?
注意:我不想使用边框,因为我想要某些行,我可能需要或不需要行内的水平线.
for*_*mma 14
添加 style="padding:0px; margin:0px;"到您的hr,并将height您的第三个更改tr为2px
你将会有 :
<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>
Run Code Online (Sandbox Code Playgroud)