HTML 签名仅在 Outlook 中调整部分图像的大小

标签 html css email outlook

我用 HTML 制作了一个电子邮件签名,它似乎遵循了大多数准则(表格、内联样式等),并且在大多数客户端上看起来相当不错。但是,它在 Outlook 上看起来一定很奇怪,因为这是在收到 Outlook 回复后返回到我的电子邮件客户端的方式:

Logo 非常好,但社交 Logo 的缩放比例非常高。但是,图像的代码如下所示:

<td valign="middle" style="padding: 0px 8px 0px 0px; border: 0px; outline: none;">
  <div style="margin: 0px; padding: 0px; border: 0px; outline: none; float: left;">
    <img width="110" height="60" src="https://i.imgur.com/FjK5XfG.png" style="border: none; vertical-align: middle;">
  </div>
</td>
  • >

最佳答案

当您将 px 单位添加到值时,Outlook(可能还有其他应用程序)似乎忽略了 heightwidth 属性。规范对此并非 100% 清楚,但是,默认情况下整数值被视为像素,您可以为百分比值添加 % 后缀。

根据规范,该值必须是非负整数,并且没有提到添加px 后缀的要求:

The width and height attributes on img, iframe, embed, object, video, and, when their type attribute is in the Image Button state, input elements may be specified to give the dimensions of the visual content of the element (the width and height respectively, relative to the nominal direction of the output medium), in CSS pixels. The attributes, if specified, must have values that are valid non-negative integers.

进一步阅读:


总而言之,有效代码应该是:

<img src="url" width="7" height="15">

关于HTML 签名仅在 Outlook 中调整部分图像的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36485410/

相关文章:

html - 按百分比设置表格行的高度在 Firefox 上不起作用。解决方案?

javascript - ul 中有多个链接,但只有第一个链接用于点击事件

javascript - 用于 html 5 Canvas 平台游戏风格游戏的弹跳物理

css - 使用 SVG 的剪辑路径

javascript - anchor 内的 Div,停止重定向

javascript - 电子邮件正文始终为空

java - 获取电子邮件客户端不支持通过 Java 发送电子邮件的 HTML 消息

javascript - 使用 z-index 切换 div

javascript - 使用 nodeFetch 在 JSON API 响应中正确显示特殊字符

objective-c - 无法发送草稿中的附件 (Mail.app)