所以我只是失去了几个小时的生命,试图赢得这场战斗,没有运气。总之,我试图用三张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>
我很抱歉有这么多冗余属性,因为我一直在努力。基本上,我正在尝试使表格精确地高出10px。然而,无论如何,GMail使其高出16px。如果我使用开发人员工具直接从源代码中删除所有三个图像,那么表将折叠为10px。此外,如果我删除三个图像中的2个,它仍然保持16px。如果TD包含图像,或者图像周围有3px的填充,那就好像TD必须是16px。
有没有人经历过这样的事情?如果是这样,任何想法?我的想法和理智都没有了......
答案 0 :(得分:10)
像Herbie说的那样,确保在TD上设置行高。
还要确保设置了字体大小,因为gmail可能会根据该单元格中的空格字符设置TD的最小高度。通常,在没有任何文本的单元格中设置1px的字体大小是很好的做法。
看起来这是为html电子邮件创建,对吗?看看这个问题是否有任何其他问题 - 它帮助了我多次http://www.emailology.org/#1和http://www.campaignmonitor.com/resources/提示。
答案 1 :(得分:4)
我还不能发表评论,所以我会发帖回答......
16px听起来像一个行高值。您是否尝试将每个TD的行高设置为10px或将每个IMG从内联更改为内联块?
答案 2 :(得分:3)
我试图弄清楚你的解决方案。
这是文字解决方案,将其放在TD标签中:
style="line-height:0"
答案 3 :(得分:2)
在<img>
标记中,您可以输入:
style="display:block;"
...或者您可以将高度设为max-height
。它应该可以解决你的问题。
答案 4 :(得分:0)
在html中 - <img>
标记不是块标记,因此我们需要使用以下css让它像块标记一样工作
style="display:block;"
使用此css,您的指定高度将完全适用于您的HTML页面。
尝试一次!