GMail迫使包含spacer.gif的TD高达16像素



所以我刚刚失去了几个小时的生命来赢得这场战斗,但没有运气。总之,我试图用三个10px的图像填充一个表,但GMail强制每个单元格为16px。以下是我正在使用的内容:

<table border="0" cellpadding="0" cellspacing="0" width="550" style="height:10px !important">
    <tr style="height:10px" height="10">
    <td width="10" height="10" style="height:10px !important">
        <img src="http://s3.amazonaws.com/meagain/images/templates/letterhead/corner_tl.gif" style="display:inline; padding: 0px; margin:0px" width="10px" height="10px"></td>
    <td width="531" height="10" style="height:10px !important; background-color:#FFFFFF;">
        <img src="http://s3.amazonaws.com/meagain/images/templates/letterhead/spacer.gif" style="display:inline; padding: 0px; margin:0px" width="10px" height="10px"></td>
    <td width="9" height="10" style="height:10px !important">
        <img src="http://s3.amazonaws.com/meagain/images/templates/letterhead/corner_tr.gif" style="display:inline; padding: 0px; margin:0px" width="9px" height="10px"></td>
    </tr>
</table>

我很抱歉有这么多多余的属性,因为我已经尝试了所有的东西。基本上,我想把桌子调高10倍。然而,不管怎样,GMail都会使其高达16像素。如果我使用开发人员工具直接从源代码中删除所有三个图像,那么表将折叠为10px。此外,如果我删除三个图像中的两个,它仍然保持16px。这几乎就像TD必须是16px,如果它包含一个图像,或者图像周围有3px的填充

有人经历过这样的事情吗?如果是的话,有什么想法吗?我的想法和理智都快用完了。。

就像Herbie所说的,确保在TD.上设置线的高度

还要确保你有一个字体大小设置,因为gmail可能会根据单元格中的空格字符设置TD的最小高度。通常,在没有任何文本的单元格中设置1px的字体大小是一种很好的做法。

看起来这是用于创建html电子邮件的,对吗?看看这个有没有其他问题——它帮了我很多次http://www.emailology.org/#1和http://www.campaignmonitor.com/resources/获取提示。

我还不能发表评论,所以我会作为答案发布。。。

16px听起来像是一个线条高度值。您是否尝试过将每个TD的线高设置为10px或将每个IMG从内联块更改为内联块?

我试图找出你的解决方案。

这是字面上的解决方案,把它放在你的TD标签中:

style="line-height:0"

<img>标签中,您可以放置以下内容:

 style="display:block;" 

或者可以将高度设置为max-height。它应该能解决你的问题。

在html中,<img>标签不是块标签,因此我们需要使用以下css使其像块标签一样工作

style="display:block;"

有了这个css,您给定的高度将完美地适用于您的HTML页面。

试试看!

最新更新