html - 图像在 Outlook 2007/2010 中被截断

标签 html image email outlook

图像丢失了顶行像素,但仅在某些情况下。示例标记:

<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td valign="top" height="20">
            <div style="line-height:0;"><img src="http://path.to/image.png" alt="" height="20" width="25" /></div>
        </td>
    </tr>
</table>

我的印象是自<img>是内联元素,它应该包含在 block 级元素中。这就是为什么我包装我的 <img><div> .但这导致了文本下挂导致我的问题 <div>太高了。所以我将行高设置为 0 作为解决方法。

不管怎样heightvalign我设置在 <td><img> , 图像的顶部仍然被切断。我发现删除行高就是答案。为什么是这样?

我将在我的 <img> 上使用 display: block将来的标签。

最佳答案

<div>根据您使用的电子邮件客户端,我们会受到不同的对待。电子邮件客户端的 IE 是 AOL(但是,谁再使用它了)。我认为 chipcullen 是对的,您有点想多了。为什么要输入不必要的代码。试一试(TD 内没有线路):

<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td><img src="http://path.to/image.png" alt="" height="20" width="25"></td>
    </tr>
</table>

或者如果你真的必须定义高度:

<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td height="20" style="height:20px;line-height:20px;"><img src="http://path.to/image.png" alt="" height="20" width="25"></td>
    </tr>
</table>

希望对您有所帮助!

关于html - 图像在 Outlook 2007/2010 中被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11201185/

相关文章:

c# - SMTP 友好名称在 3 个不同的地方——仍然没有显示

php - 当 mySQL 字段等于某个值时发送电子邮件警报

不使用 javascript 的电子邮件中的 HTML 图表

php - 如何创建 Bootstrap 网格?

html - 如何使用 css 获得这些 div 周围的边框?

ios - 代码 : compositing with alpha using core image

php - 将图像从 android 上传到 PHP 服务器

javascript - 根据单选按钮和复选框按钮显示/隐藏 div

html - 如何让这个标题跨越页面?

django - 无法使用 ImageField 在 django 中上传图像