我正在努力获取电子邮件签名以进行自定义外观。令我恼火的是,由于电子邮件客户端的呈现不一致,我不得不走这条路,但是有没有办法通过在标签本身内声明字体样式来使 @fontface
将字体应用于文本?以标准方式(无论是在标题中还是在 HTML 正文中使用样式)并不能使字体在移动电子邮件客户端上呈现,尽管它在某些桌面应用程序上可以。
我尝试在标签内设置样式。 (下面的示例)理论上这可以工作,但在浏览器上效果不佳。我应该放手吗,还是我错过了更好的方法?
为了清楚起见,这个@fontface
语法在放入正确完成的样式标签时对我有用。下面是我尝试在产生奇怪结果的标签中定义它。非字体样式很好地完成,但字体被放入 Times
,而不是 Tiemann
。 (查看 “C”
和 “Í”
以区分它们。)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-16be-with-bom" />
<title>Untitled</title>
<meta name="generator" content="BBEdit 10.5" />
</head>
<body>
<span style="@font-face
font-family:'Tiemann';
src: url('https://dl.dropboxusercontent.com/u/35370696/font_embed/tiemannlightwebfont.eot');
src: url('https://dl.dropboxusercontent.com/u/35370696/font_embed/tiemannlightwebfont.eot?#iefix') format('embedded-opentype'),
url('https://dl.dropboxusercontent.com/u/35370696/font_embed/tiemannlightwebfont.woff') format('woff'),
url('https://dl.dropboxusercontent.com/u/35370696/font_embed/Tiemann_Light.ttf') format('truetype'),
url('https://dl.dropboxusercontent.com/u/35370696/font_embed/tiemannlightwebfont.svg#Tiemann') format('svg');
font-size:22pt;
color:#6D6D6D;
float:left;
">
DIACRÍTICA
</span>
</body>
</html>
最佳答案
短篇小说:font-face
是 at-rule .没有发生。使用外部样式表并将其放在那里以获得适当的指南和可维护性。
顺便说一句,注意 @font-face
不仅可以用在 CSS 的顶层,也可以用在任何 CSS 中 conditional-group at-rule .
关于html - @fontface 可以在标签中使用吗? (为了电子邮件签名的可靠性),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19069424/