当我指定了无衬线字体时,如何阻止雅虎在 HTML 电子邮件中显示衬线字体?
我已经整理了一封 HTML 电子邮件。我们这里的一些人知道如何很好地做到这一点(表格、内联样式等),并且它可以在多个浏览器以及 Outlook、Google 和 Hotmail 中完美显示。
然而,雅虎则是另一回事。当我们指定无衬线字体时,所有文本都以衬线字体显示。下面是一个代码片段,作为如何完成的示例:
<tr>
<td colspan="2" width="600px" style="padding: 15px 0 15px 0; font-family:arial,sans-serif; font-size:40px; color:#0066cc;">
Some text in here
</td>
</tr>
我们尝试使用
标签代替并在其中设置样式,还尝试了
但这些似乎都不起作用。
有没有人有类似的经历和/或更重要的是,是否有 HTML 电子邮件专家知道如何解决此问题?
I've put together an HTML email. Together, a few of us here know how to do this pretty well (tables, inline styles, etc.) and it displays perfectly on multiple browsers and in Outlook, Google and Hotmail.
However, Yahoo is another matter. All of the text is displaying in a serif font when we have specified sans-serif. Here's a snippet of code as an example of how it's been done:
<tr>
<td colspan="2" width="600px" style="padding: 15px 0 15px 0; font-family:arial,sans-serif; font-size:40px; color:#0066cc;">
Some text in here
</td>
</tr>
We've tried using <p>
tags instead and styling inside that, also tried <font face="arial, sans-serif">
but neither of these seem to work.
Has anyone had a similar experience and/or, more importantly, are there any HTML email gurus out there who know how to resolve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先要查看的是雅虎向您的网络浏览器提供的 HTML。如果他们真的修改了 HTML,你就会得到答案。
否则,它可能是在自己的样式表中定义为“!important”的 CSS 规则。如果是这种情况,那么
font-family:sans-serif !important
可以解决您的问题。The first thing to look at is the HTML that Yahoo gives to your web browser. If they actually modified the HTML have your answer.
Otherwise, it could be a CSS rule which was defined as "!important" in their own stylesheet. If this is the case, then
font-family:sans-serif !important
could solve your issue.事实证明,雅虎邮件的字体表现似乎很奇怪。根据我的经验(以及最近的测试),似乎您只需要使用
标记的
face
属性和 仅 em>不在内联样式中使用font-family
。例如,以下代码在 Yahoo 中生成带有衬线的文本:
Text
但下一个示例可以正常工作,根据需要修改字体
Text
后者在 Gmail、Hotmail 和 Outlook 2010(以及可能的其他内容,这些只是我测试过的)中也是一致的,
祝你好运!
It turns out that Yahoo mail seems to act really strangely with font faces. In my experience (and a recent test) it seems like you need to only use the
face
attribute of the<font>
tag and not usefont-family
within the inline style.For example, the following code yields text with serifs in Yahoo:
<font face="arial,sans-serif" style="font-family:'arial','sans-serif'">Text</font>
But the next example works correctly, modifying the font face as desired
<font face="arial,sans-serif">Text</font>
The latter is also consistent across Gmail, Hotmail, and Outlook 2010 (and likely others, those are just the ones that I tested)
Good luck!
我刚刚通过雅虎运行了您的示例:
并且它呈现无衬线...唯一不正确的是 TD 宽度属性上的“px”。
也许您的代码中有一些严重错误导致了此问题?
I just ran your example through Yahoo:
And it's rendering sans serif... the only thing that is incorrect is the "px" on the width attribute of the TD.
Maybe you have some critical errors in your code that is causing this issue?