iOS Outlook应用仅在HTML电子邮件中允许单个媒体查询
我想在HTML电子邮件中以2个不同的屏幕宽度和媒体查询更改一些文本的字体大小。除了在iOS的Outlook应用程序中,所有设备/客户端都可以在所有设备/客户端上工作。
这是Inline HTML的一个示例:
<td class="para" align="left" style="border-collapse: collapse; mso-line-height-rule: exactly; font-family: Times, 'Times New Roman', serif; font-size: 17px; color: #333333; line-height: 24px; text-align: left; text-indent: 29px; padding: 20px 0 0 0;"><span style="font-family: Times, 'Times New Roman', serif !important;">some text here</span></td>
然后,我有以下CSS:
<style>
@media only screen and (max-width:600px) {
.para {
font-size: 18px !important;
}
}
@media only screen and (max-width:445px) {
.para {
font-size: 20px !important;
}
}
</style>
如果我只有一个媒体查询,则它在iOS的Outlook应用程序中按预期工作,但是当我添加第二个媒体时,媒体查询无效,全部。
我是做错了什么还是这只是您必须与iOS Outlook一起使用的事情?
I am wanting to change the font size of some text in an HTML email at 2 different screen widths with media queries. This works as expected on all devices/clients except in Outlook App for iOS.
Here is an example of the inline HTML:
<td class="para" align="left" style="border-collapse: collapse; mso-line-height-rule: exactly; font-family: Times, 'Times New Roman', serif; font-size: 17px; color: #333333; line-height: 24px; text-align: left; text-indent: 29px; padding: 20px 0 0 0;"><span style="font-family: Times, 'Times New Roman', serif !important;">some text here</span></td>
Then I have the following CSS:
<style>
@media only screen and (max-width:600px) {
.para {
font-size: 18px !important;
}
}
@media only screen and (max-width:445px) {
.para {
font-size: 20px !important;
}
}
</style>
If I only have one of the media queries, it works as expected in the Outlook App for iOS, but when I add the second one it no media queries work at all.
Am I doing something wrong or is this just something that you have to work around with iOS Outlook?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题归因于其实现中的错误,如下所示: https:// github 。
空格和创建双卷发括号,}}是关闭样式块并启动一个新的块,即:
The issue is due to a bug in their implementation, as documented here: https://github.com/hteumeuleu/email-bugs/issues/92
The easiest solution, since perhaps your minifying code may be removing whitespace and creating the double curly braces, }}, is to close the style block and start a new one, i.e.: