如何让 MS Outlook 接受 CSS 样式 display:block?

发布于 2024-12-28 14:21:07 字数 362 浏览 3 评论 0原文

我正在使用服务 (MailChimp) 撰写 HTML 电子邮件。 MailChimp 标记标题的方式是使用 SPAN 标记,并为该标记赋予内联样式 display:block

MS Outlook 2010 忽略此样式。我找不到任何解决办法。因此,标题会换行,破坏了所需的页面显示。

是的,我知道 Outlook 使用 MS Word 来显示 HTML。

假设我无法干预并手动编辑标记。

如何让 MS Outlook 接受 CSS 样式 display:block 并显示 SPAN标签作为块级元素?

I am composing an HTML email using a service (MailChimp). The way that MailChimp marks up headings is to use a SPAN tag and gives the tag the inline style of display:block.

MS Outlook 2010 ignores this style. I cannot find any work around. Thus, headings wrap, breaking the desired page display.

Yes, I know that Outlook uses MS Word to display HTML.

Assume that I cannot intervene and hand edit the markup.

How do I get MS Outlook to accept the CSS style display:block and display a SPAN tag as a block level element?

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

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

发布评论

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

评论(3

晨曦÷微暖 2025-01-04 14:21:07

此版本的 MS Outlook 不支持 CSS display 属性。

这是关于您可以使用和不能使用的内容的“书”:

campaignmonitor.com/css/

基本上,如果可以的话如果不将您的标记更改为本机块项目,您就会陷入困境。

The CSS display attribute is not supported in this version of MS Outlook.

Here's "The Book" on what you can and cannot use:

campaignmonitor.com/css/

Basically, if you can't change your mark-up to a natively-block item, you're stuck.

提赋 2025-01-04 14:21:07

不幸的是,最好的办法就是用老式的方式来做。 =[ 使用表格而不是表格。所以表=块。

The best thing is to do it the old fashion way unfortunately. =[ Use tables over tables. so tables=blocks.

唱一曲作罢 2025-01-04 14:21:07

我发现自己处于这种情况:需要创建在 Outlook 中正确显示的标题样式,但无法编辑 HTML,因为我将模板交给了客户端。

我想您已经解决了这个问题,但是对于其他花了几个小时试图回答这个问题并偶然发现这个线程的人来说,我是这样修复它的:

  1. 删除 Mailchimp 的默认 H1、H2 等。

  2. 创建您自己的标头样式(我将它们命名为 Header、Sub-Header 等,只是为了避免混淆)

  3. 根据需要使用新的标题样式。新标题显示为块。

我不太确定幕后发生了什么,因为我无法在 Outlook 中进行检查,但我的猜测是,如果不使用默认样式,Mailchimp 会将标题文本包装在 div 中而不是 span 中。

I found myself in this exact situation: needing to create header styles that displayed correctly in outlook without the ability to edit the HTML because I'm handing the template off to a client.

I imagine you've already solved this, but to anyone else who spent several hours trying to answer this question and stumbles across this thread, here's how I fixed it:

  1. Delete Mailchimp's default H1, H2, etc.

  2. Create your own header styles (I named them Header, Sub-Header, etc. just to avoid confusion)

  3. Use the new header styles as you wish. The new headings display as blocks.

I'm not exactly sure what's going on under the hood as I can't inspect in Outlook, but my guess is that by not using the default styles either Mailchimp wraps the header text in divs instead of spans.

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