即使使用条件注释,Outlook中的表宽也会更大

时间:2016-04-01 13:43:39

标签: html templates outlook html-table html-email

我正在尝试在电子邮件的单元格中放置一个表格,并且无法弄清楚如何限制Outlook中内部表格的宽度。我尝试使用“混合编码方法”(http://labs.actionrocket.co/the-hybrid-coding-approach)和THINK我正确地尝试了Outlook条件语句(http://labs.actionrocket.co/microsoft-outlook-conditional-statements)。有很多地方我正在看mso的条件评论,但每当我在Litmus测试电子邮件时,Outlook仍会在中间显示这组巨大的图像。我究竟做错了什么?任何帮助将不胜感激。

<table style="border-collapse: collapse; text-align: left; font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 12px; line-height: 15pt; color: #777777;" align="center" bgcolor="#ffffff" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td colspan="2" style="padding-top: 20px; padding-right: 30px; padding-left: 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15pt; color: #777777;" width="600">
<h2 style="font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 26px; line-height: 27pt; color: #555555; font-weight: 300; margin-top: 0; margin-bottom: 15px !important; padding: 0;">April is always <span class="highlighted" style="color: #518fce;">#BetterWithStraw</span>!</h2>
</td>
</tr>
<tr>
<td colspan="2" style="padding-right: 30px; padding-left: 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15pt; color: #777777;" valign="top" width="255">Introductory text.
<table style="border-collapse: collapse; border-spacing: 0;" cellpadding="0" cellspacing="0" width="126">
<tbody>
<tr></tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="padding-top: 5px; font-size: 2px; line-height: 0px;" height="31" width="600"><img alt="" src="https://s3.amazonaws.com/AgileEmailTemplates/newsletter/rocketmail/Blue/Light-Background/images/divider.png" style="display: block;" align="left" height="31" hspace="0" border="0" vspace="0" width="600" /></td>
</tr>
</tbody>
</table>
<!-- End of content 1--> <!-- Start of content 2-->

 <table style="border-collapse: collapse; text-align: left; font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size: 12px; line-height: 15pt; color: #777777;" align="center" bgcolor="#ffffff" cellpadding="0" cellspacing="0" width="600">
 <tbody>
 <tr>
 <td colspan="2" style="padding-top: 20px; padding-right: 30px; padding-left: 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15pt; color: #777777;" width="600">
 <h2 style="font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 26px; line-height: 27pt; color: #555555; font-weight: 300; margin-top: 0; margin-bottom: 15px !important; padding: 0;">Vote <span class="highlighted" style="color: #518fce;">here</span>!</h2>
 </td>
 </tr>
 <tr>
 <td colspan="2" style="padding-right: 30px; padding-left: 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15pt; color: #777777;" valign="top" width="255">

 <!--[if mso>
 <table width="540" border="0" cellspacing="0" cellpadding="0">
 <tr>
 <td>
 <![endif]-->

 <table style="width: 100%;" align="center" cellpadding="0">
 <tbody>
 <tr><th colspan="2"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514273836?id=tinymce_image_upload" width="100%" /></th></tr>
 <tr>
 <td><a href="http://www.google.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514291930?id=tinymce_image_upload" width="100%" /></a></td>
 <td><a href="http://www.yahoo.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514301534?id=tinymce_image_upload" width="100%" /></a></td>
 </tr>
 <tr>
 <td><a href="http://www.deadspin.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514313875?id=tinymce_image_upload" width="100%" /></a></td>
 <td><a href="http://www.bing.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514322076?id=tinymce_image_upload" width="100%" /></a></td>
 </tr>
 <tr><th colspan="2"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514330960?id=tinymce_image_upload" width="100%" /></th></tr>
 </tbody>
 </table>

 <!--[if mso>
 </td>
 </tr>
 </table>
 <![endif]-->

 <div style="display: none;">&nbsp;</div>
 <table style="border-collapse: collapse; border-spacing: 0;" cellpadding="0" cellspacing="0" width="126">
 <tbody>
 <tr></tr>
 </tbody>
 </table>
 </td>
 </tr>
 <tr>
 <td colspan="2" style="padding-top: 5px; font-size: 2px; line-height: 0px;" height="31" width="600"><img alt="" src="https://s3.amazonaws.com/AgileEmailTemplates/newsletter/rocketmail/Blue/Light-Background/images/divider.png" style="display: block;" align="left" height="31" hspace="0" border="0" vspace="0" width="600" /></td>
 </tr>
 </tbody>
 </table>

谢谢!

1 个答案:

答案 0 :(得分:0)

问题是Lotus Notes,Outlook 2003,2010和2016需要在任何图像上都有固定的宽度。如果您插入1280像素宽的视网膜图像,并将其设置为100%的宽度,那么它将忽略外部框,并且只是其原始宽度的100%。 所以你需要做的是在每个图像上画一个像这样的宽度:

<table style="width: 100%;" align="center" cellpadding="0">
                <tbody>
                    <tr>
                        <th colspan="2"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514273836?id=tinymce_image_upload" width="536" /></th>
                    </tr>
                    <tr>
                        <td>
                            <a href="http://www.google.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514291930?id=tinymce_image_upload" width="267" /></a>
                        </td>
                        <td>
                            <a href="http://www.yahoo.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514301534?id=tinymce_image_upload" width="267" /></a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="http://www.deadspin.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514313875?id=tinymce_image_upload" width="267" /></a>
                        </td>
                        <td>
                            <a href="http://www.bing.com" target="new"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514322076?id=tinymce_image_upload" width="267" /></a>
                        </td>
                    </tr>
                    <tr>
                        <th colspan="2"><img src="https://s3.amazonaws.com/agilecrm/panel/uploaded-logo/1459514330960?id=tinymce_image_upload" width="536" /></th>
                    </tr>
                </tbody>
            </table>

然后使用媒体查询使其成为移动设备的最佳选择

@media screen and (max-width: 480px) {
  a img{
    max-width:100% !important;
    width:100% !important;
    }
}