如何让 MS Outlook 接受 CSS 样式 display:block?
我正在使用服务 (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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此版本的 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.
不幸的是,最好的办法就是用老式的方式来做。 =[ 使用表格而不是表格。所以表=块。
The best thing is to do it the old fashion way unfortunately. =[ Use tables over tables. so tables=blocks.
我发现自己处于这种情况:需要创建在 Outlook 中正确显示的标题样式,但无法编辑 HTML,因为我将模板交给了客户端。
我想您已经解决了这个问题,但是对于其他花了几个小时试图回答这个问题并偶然发现这个线程的人来说,我是这样修复它的:
删除 Mailchimp 的默认 H1、H2 等。
创建您自己的标头样式(我将它们命名为 Header、Sub-Header 等,只是为了避免混淆)
根据需要使用新的标题样式。新标题显示为块。
我不太确定幕后发生了什么,因为我无法在 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:
Delete Mailchimp's default H1, H2, etc.
Create your own header styles (I named them Header, Sub-Header, etc. just to avoid confusion)
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.