简体   繁体   中英

Why is there white space between the elements in my <div> container?

I'm very new to HTML, and I've built a custom HTML email signature. I want it to look like this:

在此处输入图片说明

However, with my code below, the three strings I'm grouping next to each other end up with white space between the first and subsequent strings as shown below

在此处输入图片说明

What is a proper way to group the three strings together without getting a gap between elements?

<div class="presentational-container">
  <table role="presentation" cellpadding="0" cellspacing="0" border="0"style="background: none;margin: 0;padding: 10px 10px 0;border-width: 1px 0 0 0;border-style: solid;border-color: #F2F2F2;">
    <tbody>
      <tr class="outer-row" style="padding: 0 12px 0 0;">
        <td class="headshot-cell" style="text-decoration: none;vertical-align: middle;width: 72px;padding: 0 6px 0 0;">
          <a href="http://www.robertcooper.me">
            <img src="https://tetonsports.imagerelay.com/ql/6cde221aa42c4ec8b325b3c0f6235d2e/email-icon-01.png" name="preview-image-url" style="vertical-align: middle;width:72px"/>
          </a>
        </td>
        <td class="description-cell">
          <table role="presentation">
            <tbody>
              <tr>
                <td colspan="2" class="company" style="font-weight: normal;color: #000001;font-size: 14px;font-family: Helvetica, Geneva, sans-serif;">TETON Sports</td>
              </tr>
              <tr>
                <div>
                  <td colspan="2" class="name" style="font-weight: bold;color: #000001;font-size: 14px;font-family: Helvetica, Geneva, sans-serif;">Josh Jorgensen</td>
                  <td colspan="2" class="divider" style="font-weight: bold;color: #FF9E18;font-size: 14px;font-family: Helvetica, Geneva, sans-serif;">//</td>
                  <td colspan="2" class="title" style="font-style: italic;font-weight: normal;color: #54565A;font-size: 14px;font-family: Helvetica, Geneva, sans-serif;">Photographer</td>
                </div>
              </tr>
              <tr>
                <td valign="top" class="website" style="font-style: italic;font-weight: normal;color: #54565A;font-size: 14px;font-family: Helvetica, Geneva, sans-serif;">
                  <a href="josh@tetonsports.com">josh@tetonsports.com</a>
                </td>
              </tr>
            </tbody>
          </table>
        </td>
      </tr>
    </tbody>
  </table>
</div>

Those three text parts are in separate table cells, and these tablecells even have colspan="2" . So these are aligned with the table cells of the rows above and below which also have colspan="2" .

I would either put all three in one cell, or at least remove the colspan="2" from them and add colspan="3" to the cells below and above, since all rows should have the same amount of cells for lining up properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM