简体   繁体   中英

Change cell height in a table when sending HTML email to Gmail

I'm trying to send out an HTML email from Outlook 2013 to Gmail but I noticed that I get a big gap between the rows. I can not change the height of the rows no matter what I do. I'm looking for some advice to fix this. Here is my code:

  <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">
        table {
            border-collapse: collapse;
            mso-table-lspace: 0pt;
            mso-table-rspace: 0pt;
            border-spacing: 0;
        }
    </style>
</head>
<body>
    <table style="font-family: Arial; color: #646464; font-size: 8pt">
        <tr>
            <td style="font-weight: bold; font-size: 9pt; padding-bottom: 7px;">Test User</td>
        </tr>
        <tr>
            <td style="font-size: 1px; line-height: 0; border-top: solid 1px #646464;">&nbsp;</td>
        </tr>
    </table>
</body>
</html>

Try inlining your border-collapse and border-spacing css to your table. GMail strips the style tag before parsing.

For that second <td> you should set height="1" . The height attribute for <td> s is how you set the height of rows. That nbsp fix is good for Outlook '13, but watch out that you don't use it too often. SpamAssassin sees any font-size less than 5px as possible spammy content.

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