HTML电子邮件文本不正确显示在Gmail移动

HTML email text not displaying correctly in Gmail Mobile

本文关键字:Gmail 移动 显示 不正确 电子邮件 文本 HTML      更新时间:2023-09-26

我的电子邮件在所有客户端中看起来都很棒…除了Gmail Mobile。具体来说,它把我的导航栏链接和页脚栏链接(它们是表格)推到左边,而不是把它们居中。

任何建议吗?

导航条码:

<td style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/tees" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;">TEES
                                 </a></td>
                            <td width="0">
                              <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                                <tbody>
                                  <tr>
                                  </tr>
                                </tbody>
                              </table>
                            </td>
                            <td style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/tanks" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;">TANKS</a></td>
                            <td class="ecxh" width="0">
                              <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                                <tbody>
                                  <tr>
                                  </tr>
                                </tbody>
                              </table>
                            </td>
                            <td class="ecxh" style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/accessories" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;">ACCESSORIES
                                 </a></td>
                            <td class="ecxh" width="0">
                              <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                                <tbody>
                                  <tr>
                                  </tr>
                                </tbody>
                              </table>
                            </td>
                            <td class="ecxh" style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/sale" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;white-space:nowrap;">SALE</a></td>
                            <td class="ecxh" width="0">
                              <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                                <tbody>
                                  <tr>
                                  </tr>
                                </tbody>
                              </table>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                </tbody>
              </table>

我的页脚与此相似,除了使用图像链接而不是文本。

查看代码后,似乎使用了align="center"属性来居中表。我建议使用CSS而不是HTML属性。你可以使用margin:0 auto; CSS属性来居中一个表在它的父容器。

请参阅下面更新的代码:

<table class="ecxw320" align="center" border="0" cellpadding="0" cellspacing="0" width="640">
  <tbody>
    <tr bgcolor="#000000">
      <td height="50">
        <!--Use margin:0 auto; to center a table within it's parent container-->
        <table style="margin:0 auto;" border="0" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td>
                <table align="center" border="0" cellpadding="0" cellspacing="0">
                  <tbody>
                    <tr>
                      <td width="20">
                      </td>
                    </tr>
                  </tbody>
                </table>
              </td>
              <td style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/tees" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;">TEES
                                 </a>
              </td>
              <td width="0">
                <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                  <tbody>
                    <tr>
                    </tr>
                  </tbody>
                </table>
              </td>
              <td style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/tanks" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;">TANKS</a>
              </td>
              <td class="ecxh" width="0">
                <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                  <tbody>
                    <tr>
                    </tr>
                  </tbody>
                </table>
              </td>
              <td class="ecxh" style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/accessories" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;">ACCESSORIES
                                 </a>
              </td>
              <td class="ecxh" width="0">
                <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                  <tbody>
                    <tr>
                    </tr>
                  </tbody>
                </table>
              </td>
              <td class="ecxh" style="font-family:'Helvetica',
monospace;font-size:12px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;"><a moz-do-not-send="true" href="https://partofthekult.com/collections/sale" target="_blank" style="font-family:'Helvetica',
monospace;font-size:15px;line-height:15px;color:#FFFFFF;text-align:center;text-decoration:none;display:block;white-space:nowrap;">SALE</a>
              </td>
              <td class="ecxh" width="0">
                <table align="center" border="0" cellpadding="0" cellspacing="0" width="20">
                  <tbody>
                    <tr>
                    </tr>
                  </tbody>
                </table>
              </td>
            </tr>
          </tbody>
        </table>
      </td>
    </tr>
  </tbody>
</table>