Обрыв ‹td› только в Outlook 2016

У меня есть электронная почта с img и «границей», сделанная с помощью td. Только в Outlook 2016 td с шириной 260 пикселей отображается с разрывом посередине. Я не могу найти почему. Я скопировал много стилей с cellpading:0, celspaccing:0 и т. д., но ничего не помогает. Кажется, проблема возникает только в Outlook 2016. Тот же код электронной почты работает нормально в других Outlook и почтовых веб-клиентах.

Это мой html-код:

    <table style="border-collapse:collapse;margin: 0; padding: 0; line-height: 0; font-size: 0; width: 335px; display: inline-block; text-align: center; vertical-align: top;"
  border="0" cellspacing="0" cellpadding="0" align="center" valign="top">
  <tbody>
    <tr>
      <td style="margin: 0; padding: 0; width: 20px; display: inline-block; text-align: center;" width="20">
      </td>
      <td style="margin: 0; padding: 0; line-height: 0; font-size: 0; width: 270px; text-align: center; background-color: #ffe0e6;"
        border="0" cellspacing="0" cellpadding="0" align="center" width="270">
        <img src="https://picsum.photos/270/270" width="270" style="max-width: 270px; max-height: 270px; margin: 0; padding: 0; line-height: 0; font-size: 0; border: 0; outline: 0; display: block; border-collapse:collapse;"
          border="0" outline="0" height="270" align="top" cellpadding=”0″>
      </td>
      <td style="margin: 0; padding: 0; line-height: 0; font-size: 0; text-align: center;" border="0" cellspacing="0" cellpadding="0"
        align="center">
        <table style="border-collapse:collapse;margin: 0; padding: 0; display: inline-block; line-height: 0; text-align: center; font-size: 0; vertical-align: top;"
          border="0" cellspacing="0" cellpadding="0" align="center">
          <tbody>
            <tr>
              <td style="width:10px; height: 10px; line-height:0; font-size: 0" height="10" width="10">&nbsp;
              </td>
            </tr>
            <tr>
              <td style="width:10px; height: 260px; background-color: #ffe0e6;  line-height:0; font-size: 0" height="260" width="10">&nbsp;
              </td>
            </tr>
          </tbody>
        </table>
      </td>
      <td style="margin: 0; padding: 0; width: 25px; display: inline-block; text-align: center; height: 270px;" width="25" height="270">&nbsp;
      </td>
    </tr>
    <tr>
      <td style="margin: 0; padding: 0; width: 20px; height: 10px; display: inline-block; text-align: center; line-height:0; font-size: 0"
        width="20" height="10">
      </td>
      <td style="margin: 0; padding: 0; line-height: 0; font-size: 0; text-align: center;" border="0" cellspacing="0" cellpadding="0"
        align="center">
        <table style="border-collapse:collapse;margin: 0; padding: 0; display: inline-block; text-align: center; font-size: 0; line-height: 0; vertical-align: top; height: 10px"
          border="0" cellspacing="0" cellpadding="0" align="center" height="10">
          <tbody>
            <tr>
              <td style="margin: 0; padding: 0; height: 10px; width: 10px; line-height:0; font-size: 0; background-color: #ffffff;" width="10"
                height="10">&nbsp;
              </td>
              <td style="margin: 0; padding: 0; height: 10px; width: 260px; line-height:0; font-size: 0;  background-color: #ffe0e6;" width="260"
                height="10">&nbsp;
              </td>
            </tr>
          </tbody>
        </table>
      </td>
      <td style="margin: 0; padding: 0; height: 10px; width: 10px; line-height:0; font-size: 0; background-color: #ffe0e6;" width="10"
        height="10">&nbsp;
      </td>
      <td style="margin: 0; padding: 0; width: 35px; display: inline-block; line-height:0; font-size: 0; text-align: center;" width="35">&nbsp;
      </td>
    </tr>
    <tr>
      <td style="margin: 0; padding: 0; height: 30px; display: inline-block; line-height:0; font-size: 0; text-align: center;"
        height="30">&nbsp;
      </td>
    </tr>
  </tbody>
</table>

Я обвел разрыв в этом розовом элементе td, где происходит разрыв

введите здесь описание изображения

Эта розовая вертикальная линия должна быть полностью розовой. Это тд:

<td style="width:10px; height: 260px; background-color: #ffe0e6;  line-height:0; font-size: 0" height="260" width="10">&nbsp;
              </td>

person Peter B.    schedule 27.07.2018    source источник


Ответы (1)


Ваша структура таблицы кажется излишне сложной. В ваших встроенных стилях было несколько команд, которые не должны были быть там. У вас также были ячейки таблицы с левой стороны, которые, казалось, ничего не делали. Поэтому для простоты я создал новую таблицу. Для простоты я создал таблицу стилей:

Таблица стилей:

<style>
  table {
    border-spacing: 0 !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
    margin: 0 auto !important;
  }
</style>
<!--[if mso]><style>
  table, td {
    mso-table-lspace: 0pt !important;
    mso-table-rspace: 0pt !important;
    border-collapse: collapse;
  }
  img {
    -ms-interpolation-mode:bicubic;
  }
</style><![endif]-->

Код:

<table border="0" cellspacing="0" cellpadding="0">
  <tr>
      <td bgcolor="#ff0000">
        <img src="https://picsum.photos/270/270" width="270" style="max-width: 270px; max-height: 270px; margin: 0; padding: 0; line-height: 0; display: block;" border="0" outline="0" height="270" align="top" /></td>
      <td bgcolor="#ff0000" valign="top" width="10">
        <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin: 0; padding: 0; line-height: 0; text-align: center; font-size: 0; vertical-align: top;">
            <tr>
              <td width="10" height="10">&nbsp;
              </td>
            </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td bgcolor="#ff0000" align="left" height="10" style="max-height: 10px !important;">
        <table align="left" bgcolor="#ffffff" height="10" height="10" border="0" cellspacing="0" cellpadding="0" style="margin: 0; padding: 0; line-height: 0; font-size: 0;">
            <tr>
              <td width="10" height="10">
              </td>
            </tr>
        </table>
    </td>
    <td bgcolor="#ff0000"></td>
</tr>   

I tested this in Litmus to make sure it worked in all of the Outlook versions, Gmail and Apple / Android.

Более простой способ получить тот же эффект — использовать box-shadow:

<img src="https://picsum.photos/270/270" width="270" style="max-width: 270px; max-height: 270px; margin: 0; padding: 0; line-height: 0; display: block; box-shadow: 10px 10px 0px red;" border="0" outline="0" height="270" align="top" />

Предостережение в том, что это не работает для Outlook, Gmail, но если это работает для вас, его намного проще стилизовать. Я упоминаю об этом для других людей, которые ищут способы добавить тень к изображению.

Удачи.

person gwally    schedule 27.07.2018