1

我试图在页面内添加这个东西,但它不起作用。有没有办法内联指定这些样式?

   @font-face {
  font-family: 'Cuprum';
  font-style: normal;
  font-weight: 400;
  src: local('Cuprum'), local('Cuprum-Regular'), url(http://themes.googleusercontent.com/static/fonts/cuprum/v4/sp1_LTSOMWWV0K5VTuZzvQ.woff) format('woff');
}
@font-face {
  font-family: 'Cuprum';
  font-style: normal;
  font-weight: 700;
  src: local('Cuprum Bold'), local('Cuprum-Bold'), url(http://themes.googleusercontent.com/static/fonts/cuprum/v4/SfDyn5tWOk7I1we45jpLKz8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
4

1 回答 1

2

将它们放在style元素内部的head元素中,例如

<!doctype html>
<title>Your title</title>
<style>
  /* put your CSS code here */
</style>
<h1>Hello world</h1>

如果您无法在head部件中设置元素(可能是,在以 HTML 格式合成电子邮件时,取决于编写程序),那么您可以尝试将style元素放在body. 那将是无效的,但它仍然适用于浏览器。

电子邮件客户端是否会识别它并使用可下载字体是一个不同的问题 - 并且取决于客户端。

于 2012-10-01T06:43:53.647 回答