用于Outlook的HTML电子邮件中的不需要的间隙
问题描述:
我正在制作一个HTML电子邮件,它可以在不使用媒体查询的情况下响应。它可以工作,但在我们很多客户使用的Microsoft Outlook 2010中,它显示了两个表之间的差距。在其他任何设备上,它都不显示间隙。我如何消除Outlook中的差距?用于Outlook的HTML电子邮件中的不需要的间隙
注:我需要使用多个表,以便将电子邮件响应。如果我使用另一个td,它将不会响应。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
table td {
border-collapse: collapse;
}
.msoFix {
mso-table-lspace: -1pt;
mso-table-rspace: -1pt;
}
</style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<div style="max-width:640px !important;">
<table class="msoFix" width="320" cellpadding="0" cellspacing="0" align="left" bgcolor="#CCCCCC">
<tr>
<td width="290" bgcolor="454545" align="left" style="padding: 0px;"><br>Table 1</td>
</tr>
</table>
<table class="msoFix" width="320" cellpadding="0" cellspacing="0" align="left" bgcolor="#EEEEEE">
<tr>
<td width="290" bgcolor="959595" align="left" style="padding: 0px;"><br>Table 2</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>
答
的解决方案是嵌套在另一个表,并应用cellpaddin =“0”和CELLSPACING两个表=“0”
您还需要一个条件语句来使表栈上前景,所以你可以保持它的响应。
我已经测试使用石蕊,这工作正常,代码如下。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
table td {
border-collapse: collapse;
}
.msoFix {
mso-table-lspace: -1pt;
mso-table-rspace: -1pt;
}
</style>
</head>
<body style="margin: 0px; padding: 0px; background-color: #FFFFFF;" bgcolor="#FFFFFF">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<table class="msoFix" width="320" cellpadding="0" cellspacing="0" align="left" bgcolor="#CCCCCC">
<tr>
<td width="290" bgcolor="454545" align="left" style="padding: 0px;"><br>Table 1</td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
<td valign="top">
<![endif]-->
<table class="msoFix" width="320" cellpadding="0" cellspacing="0" align="left" bgcolor="#EEEEEE">
<tr>
<td width="290" bgcolor="959595" align="left" style="padding: 0px;"><br>Table 2</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>