小行高在 MS Outlook 中渲染不正确

发布于 2024-09-26 19:15:19 字数 109 浏览 0 评论 0原文

经过一些研究,我发现 MS Outlook 不会在 HTML 电子邮件中呈现小于 16 像素的行高。

这是一个问题,因为我确实需要它小一些。

有谁知道这个问题的修复方法吗?

From doing a little research I've found that MS Outlook will not render line-height in an HTML email at anything less than 16px.

This is a bit of a problem as I really need it a fair amount smaller.

Does anyone know of a fix for this??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酒废 2024-10-03 19:15:19

您使用什么代码?它会低于 16px,但前提是字体大小为 14px 或更小。另外,请确保您在父 TD 上设置行高 - 即在最近的块级元素上,而不是内联元素上。

What code are you using? It will go lower than 16px, but only if the font-size is 14px or smaller. Also, make sure you are setting the line-height on the parent TD - i.e. on the closest block-level element, rather than an inline element.

吖咩 2024-10-03 19:15:19

确保内边距和边距为 0,所有内联内容(尤其是图像!)上都有“display:block”,并将行高设置为您期望的高度。

Outlook<2007使用IE作为渲染引擎,2010使用WORD。

是的,这很蹩脚。

make sure you have 0 padding and margins, have "display:block" on everything inline (esp. images!) and set line-height to the height you expect.

Outlook <2007 uses IE as a rendering engine, 2010 uses WORD.

Yes, it's very lame.

翻了热茶 2024-10-03 19:15:19

此 CSS 可能会解决此问题,但它仅适用于块元素(p、div 等):

mso-line-height-rule:exactly; line-height:10px;

如果您尝试创建垂直间距,请使用 line-heightfont-size 强制设置高度:

line-height:5px;font-size:5px;height:5px;

Outlook.com (Hotmail) 将使用他们的 CSS 覆盖您的 line-height CSS,因此您需要在他们修改后使用它来“重置”您的 CSS it:

.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font,
  .ExternalClass td, .ExternalClass div {line-height: 100% !important;}

Outlook.com 继续: 然后,如果您有任何具有 line-height:0 的元素,您将需要给它们一个 id 属性,然后专门重置这些属性:

.ExternalClass #elementWithNoLineHeight { line-height:0 !important; }

This CSS might fix the issue, but it will only work on block elements (p, div, ..etc):

mso-line-height-rule:exactly; line-height:10px;

If you are trying to create vertical spacing, use the line-height and font-size to enforce a height:

line-height:5px;font-size:5px;height:5px;

Outlook.com (Hotmail) will override your line-height CSS with theirs, so you need to use this to "reset" your CSS after they modify it:

.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font,
  .ExternalClass td, .ExternalClass div {line-height: 100% !important;}

Outlook.com continued: Then if you have any elements that had line-height:0 you will need to give them an id attribute, and then specifically reset those:

.ExternalClass #elementWithNoLineHeight { line-height:0 !important; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文