减少HTML表行高度

前端之家收集整理的这篇文章主要介绍了减少HTML表行高度前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有几行的表.我希望第1和第3行高度设置为1 px,第2行设置为正常高度.但我的代码不起作用.

HTML CODE如下@H_301_3@

  1. <table border="0">
  2. <tr style="height:2px;" >
  3. <td width="10"><hr></td>
  4.  
  5. </tr>
  6. <tr style="height:20px;" >
  7. <td width="10">Hello</td>
  8.  
  9. </tr>
  10. <tr style="height:20px;" >
  11. <td width="10"><hr></td>
  12.  
  13. </tr>
  14. </table>

谁能告诉我怎么做?@H_301_3@

注意:我不想使用边框,因为我想要某些行,我可能需要或不需要行内的水平线.@H_301_3@

解决方法

添加style =“padding:0px; margin:0px;”到你的小时,并将你的第三个tr的高度改为2px

你将会有 :@H_301_3@

  1. <table border="0">
  2. <tr style="height:2px;" >
  3. <td width="10px"><hr style="padding:0px; margin:0px;"></td>
  4. </tr>
  5. <tr style="height:20px;" >
  6. <td width="10px">Hello</td>
  7. </tr>
  8. <tr style="height:2px;" >
  9. <td width="10px"><hr style="padding:0px; margin:0px;"></td>
  10. </tr>
  11. </table>

猜你在找的HTML相关文章