繁体   English   中英

电子邮件新闻稿:如何使标题的行高保持一致?

[英]E-mail newsletters: how do I keep line height for headers consistent?

我一直在浏览有关电子邮件通讯设计和编码的行贿补丁。 一个问题不断出现:不同电子邮件客户端之间标题的行高不一致。

一组标题提供了大量空间,其中包括Gmail和iPhone: Gmail中的新闻通讯

另一组,主要是Outlook,以较小的回旋余地显示标题: 在此处输入图片说明

我的代码如下:

<table width="540" cellpadding="0" cellspacing="0" border="0">
<tr>
    <td colspan="5" width="270" height="7" style="line-height: 7px;"><img src="img/shading-top-orange.gif" width="270" height="7" style="display:block;"></td>
    <td rowspan="3" width="270" height="199"><img editable width="270" height="199" style="display:block;"></td>
</tr>
<tr bgcolor="#f68b1f" >
    <td width="10" height="185"><img src="img/shading-left-large.gif" width="10" height="185" style="display:block;"></td>
    <td width="15" height="185" bgcolor="#f68b1f"></td>
    <td width="223" height="185" bgcolor="#f68b1f" align="left" valign="top"><a name="item2" style="text-decoration: none;"><h2 style="font-family: Arial, Verdana, sans-serif; font-size: 15px; color: white !important; color:white;"><singleline label="Title" repeatertitle="true" style="color: white;">Lorem ipsum</singleline></h2></a><multiline><p style="font-family: Arial, Verdana, sans-serif; font-size: 12px; color: white;">Lorem ipsum dolor sit amet</p></multiline></td>
    <td width="15" height="185" bgcolor="#f68b1f"></td>
    <td width="7" height="185"><img src="img/shading-right-small.gif" width="7" height="185" style="display: block;"></td>
</tr>
<tr>
    <td colspan="5" width="270" height="7" style="line-height: 7px;"><img src="img/shading-bottom-orange.gif" width="270" height="7" style="display:block;"></td>
</tr>

newletter应用程序根据需要填写文本。

我该如何编写代码,以使所有(或大多数)客户端都能像在Gmail中一样呈现标题? 我已经尝试了很多方法,例如为标题添加另一个嵌套表,为其提供橙色顶部边框等。这些修复程序还影响Gmail的呈现,这不是我想要的。

如您所见,您不想依赖HTML电子邮件中的line-height ,因为客户端之间的支持非常差且不一致。 不幸的是,要解决这个问题的方法就是重构代码,以使某些tables嵌套。

在这里查看这个小提琴 ,基本上我只是在第二个trtd内嵌套了另一个table 该表有一个完整的td ,唯一要做的就是将其设置为特定的高度,并在标题上方创建一些填充:

<tr bgcolor="#f68b1f" >
    <td width="10" height="185"><img src="img/shading-left-large.gif" width="10" height="185" style="display:block;"></td>
    <td colspan="3">  
        <table> <!--the new nested table-->
            <tr>
                <td bgcolor="#f68b1f" colspan="3" height="15"></td>
            </tr>

不幸的是,在HTML电子邮件世界中,您将不得不依靠这些基于表的布局hack,而不是像line-height这样的实际CSS。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM