0

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>

I am sending html email (code like above) but mail appers incorrect in gmail.com and outlook.com. Both of them adds p tag around the a tag and span tag arround the img tag like this ;

<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>

and so looks gap between tr tags. How can I solve this?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
midstack
  • 2,105
  • 7
  • 44
  • 73
  • I can't duplicate the issue. If I send that to a gmail address, it doesn't get extra markup. So the problem must lie elsewhere (e.g. with how you send it). By the way, the contents of an email are not a complete HTML file. And email clients don't do XHTML. – Mr Lister Sep 18 '13 at 10:19
  • [XHTML is fine](http://www.campaignmonitor.com/blog/post/3317/correct-doctype-to-use-in-html-email/), some clients actually convert the code to xhtml when rendering it. – John Sep 18 '13 at 13:58

1 Answers1

1

Use style="margin: 0; border: 0; padding: 0; display: block;" for all images.

Also, adding table td {border-collapse: collapse;} to your header style tag may help with Outlook.

John
  • 11,985
  • 3
  • 45
  • 60