【问题标题】:Remove padding between table's images删除表格图像之间的填充
【发布时间】:2018-01-05 03:10:13
【问题描述】:

在我的一生中,我无法摆脱徽标与其下方其他图像之间的填充。我圈出了间距。图像应相互对齐。没有空白。我错过了什么?

我的代码:

table {
  border-spacing: 0px;
}

tr {
  padding: 0px;
}

td {
  padding: 0px;
}

td.purpSpacerAlign {
  vertical-align: bottom;
}

img {
  vertical-align: top;
}
<table>
  <tr>
    <td colspan="9">
      <img src="images/logo_lt.gif"></td>
    <td colspan="3">
      <img src="images/logo_rt.gif"></td>
  </tr>

  <tr>
    <td>
      <img src="images/purple_line_lt.gif" width="23" height="27"></td>
    <td>
      <img src="images/nav_grad_home.gif"></td>
    <td>
      <img src="images/spacer.gif" width="32"></td>
    <td>
      <img src="images/spacer.gif" width="32"></td>
    <td>
      <img src="images/spacer.gif" width="32"></td>
    <td>
      <img src="images/spacer.gif" width="32"></td>
    <td>
      <img src="images/spacer.gif" width="32"></td>
    <td>
      <img src="images/spacer.gif" width="5"></td>
    <td>
      <img src="images/spacer.gif" width="20"></td>
    <td>
      <img src="images/logo_crafts.gif"></td>
    <td>
      <img src="images/top_grad_line.gif"></td>
    <td class="purpSpacerAlign">
      <img src="images/spacer_purple.gif"></td>
  </tr>
</table>

【问题讨论】:

    标签: html css html-table padding spacing


    【解决方案1】:

    没有任何上下文,这很难回答。我假设这是一个 HTML 表格?虽然这只是一种解决方法,(没有看到您的代码),

    尝试将其添加到您的 html 中,看看是否有帮助:

    <style>
    * { margin: 0; border: 0; padding: 0}
    </style>
    

    【讨论】:

    • 我尝试添加内部样式,但它什么也没做:(
    【解决方案2】:

    直接在元素上

    <table cellspacing="0" cellpadding="0">
    

    使用 CSS

    table {
        border-collapse: collapse;
    }
    th, td {
        padding: 0;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 2022-10-07
      • 1970-01-01
      • 2021-04-20
      • 2013-04-26
      相关资源
      最近更新 更多