【问题标题】:Html email issue for outlook.com and gmail.comoutlook.com 和 gmail.com 的 HTML 电子邮件问题
【发布时间】:2013-09-22 21:19:42
【问题描述】:

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
    <table cellpadding="0" cellspacing="0" border="0" align="center" width="600" height="931">
        <tr>
            <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_01.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_02.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_03.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_04.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_05.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_06.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_07.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_08.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_09.png" alt="" style="display:block;" width="600" height="100" border="0" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <a href="http://www.google.com" target="_blank">
                <img src="images/img_10.png" alt="" style="display:block;" width="600" height="31" border="0" />
            </a>
        </td>
    </tr>
</table>
</body>
</html>

我正在发送 html 电子邮件(代码如上),但邮件在 gmail.com 和 Outlook.com 中显示不正确。他们都在a标签周围添加p标签,在img标签周围添加span标签;

<td>
  <p class="some class name"
    <a href="http://www.google.com" target="_blank">
      <span class="some class name">
        <img src="images/img_10.png" alt="" style="display:block;" width="600" height="31" border="0" />
      </span> 
    </a>
  </p>
</td>

所以看起来 tr 标签之间的差距。我该如何解决这个问题?

【问题讨论】:

  • 我无法复制该问题。如果我将它发送到 gmail 地址,它不会得到额外的标记。所以问题一定出在其他地方(例如你如何发送它)。顺便说一句,电子邮件的内容不是完整的 HTML 文件。并且电子邮件客户端不使用 XHTML。
  • XHTML is fine,有些客户端在渲染的时候实际上是把代码转换成xhtml的。

标签: html html-table gmail html-email outlook.com


【解决方案1】:

对所有图片使用style="margin: 0; border: 0; padding: 0; display: block;"

此外,将table td {border-collapse: collapse;} 添加到您的标题样式标签可能对 Outlook 有所帮助。

【讨论】:

    猜你喜欢
    • 2017-12-29
    • 1970-01-01
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多