You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Microsoft Outlook HTML邮件图片上下间隙问题技术问询

解决Outlook 365中HTML邮件表格图片上下间隙问题

针对你遇到的Outlook 365(版本2412 2025)表格内图片上下间隙问题,可尝试以下针对性修复方案:

  • 添加Outlook专属老式属性:给<img>标签加上vspace="0"和hspace="0"属性,强制消除邮件客户端默认添加的额外间距,同时保留你已设置的块级显示等样式:
<img src="your-property-image.jpg" alt="Property Image" vspace="0" hspace="0" style="display:block; line-height:0; font-size:0; margin:0; padding:0; border:none;" width="100%" height="auto" />
  • 父表格添加微软专属样式:在包含图片的父<table>上设置mso-table-lspace:0pt; mso-table-rspace:0pt;,这是Outlook识别的私有样式,可消除表格单元格间的默认间隙,同时给包裹图片的<td>设置行高和字体大小为0:
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;">
  <tr>
    <td style="padding:0; margin:0; line-height:0; font-size:0;">
      <img src="your-property-image.jpg" alt="Property Image" style="display:block; margin:0; padding:0; border:none;" width="100%" height="auto" />
    </td>
  </tr>
</table>
  • 使用固定像素高度替代百分比:Outlook对百分比高度的渲染支持不稳定,如果<td>高度固定,直接给图片设置相同的固定像素高度,避免高度计算误差:
<td style="padding:0; margin:0; height:350px;">
  <img src="your-property-image.jpg" alt="Property Image" style="display:block; margin:0; padding:0; border:none;" width="100%" height="350" />
</td>
  • 用条件注释给Outlook单独加样式:通过微软条件注释,仅给Outlook加载专属样式,不影响其他邮件客户端:
<!--[if mso]>
<style>
  .property-img { display:block; line-height:0; font-size:0; margin:0; padding:0; }
  .img-container { line-height:0; font-size:0; padding:0; margin:0; }
</style>
<![endif]-->

<td class="img-container" style="padding:0; margin:0;">
  <img class="property-img" src="your-property-image.jpg" alt="Property Image" vspace="0" hspace="0" width="100%" height="auto" />
</td>

内容的提问来源于stack exchange,提问作者TimBlowers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 05:52:08