加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

减少HTML表行高度

发布时间:2020-12-14 18:35:13 所属栏目:资源 来源:网络整理
导读:我有几行的表.我希望第1和第3行高度设置为1 px,第2行设置为正常高度.但我的代码不起作用. HTML CODE如下 table border="0" tr style="height:2px;" td width="10"hr/td /trtr style="height:20px;" td width="10"Hello/td /tr tr style="height:20px;" td wi
我有几行的表.我希望第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>

谁能告诉我怎么做?

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

解决方法

添加style =“padding:0px; margin:0px;”到你的小时,并将你的第三个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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读