html - 在拥有的远程服务器上实现自定义字体不起作用
问题描述
我正在尝试在拥有的远程服务器上使用字体,但它没有在 Mailchimp 中加载。你能看一下代码,让我知道我应该去哪里解决问题吗?谢谢
<link href="https://.................ttf" rel="stylesheet" type="text/css" />
<style type="text/css">h1,h2,h3,h4,h5,p {
font-family: 'iransans', serif !important;
font-weight: 300 !important;
}
h1 {
line-height:44px !important;
color: #111 !important;
}
</style>
<h1>Testing<br />
Marketing academy</h1>
解决方案
您正在使用不正确的方法来初始化字体。正确的是
<style type="text/css">
@font-face {
font-family: 'iransans';
src: url(https://.................ttf) format("truetype");
}
h1,h2,h3,h4,h5,p {
font-family: 'iransans', serif !important;
}
h1 {
line-height:44px !important;
color: #111 !important;
}
</style>
<h1>Testing<br />
Marketing academy</h1>
更新
或者使用以下代码制作一个单独的文档,例如iransans.cssstile
(有时标签会被邮件客户端忽略):
@font-face {
font-family: 'iransans';
src: url(https://.................ttf) format("truetype");
}
然后你可以添加到你的html:
<link href="https://yourdomain.com/iransans.css" rel="stylesheet" type="text/css">
它们添加为样式或单行:
<p style="font-family: ‘iransans’, Arial, sans-serif;">...</p>
但!如果您想在 Gmail 中使用自定义字体 - 您只能从这里使用一种https://fonts.google.com/
推荐阅读
- regex - ADFS 声明规则中的正则表达式负前瞻
- javascript - 重用 React 组件的业务逻辑
- javascript - 使用 onclick 切换 2 个滑块
- postgresql - 使用 3 IN 的查询在表中索引什么?
- php - 如何每周按用户 ID 对表列求和并在 PHP 中回显
- amazon-web-services - AWS Ubuntu Server 已满,但为什么呢?
- javascript - 打字稿标记的联合未在 switch 语句中进行类型检查
- html - 如何在同一行添加一些东西?
- asp.net - 将 https://www 重定向到 https://no-www 网络配置 您的连接不安全
- angular - 路由守卫方法破坏路由