小编Chr*_*ina的帖子

在CSS中使用@font_face添加本地ttf字体

我正在尝试将本地字体添加到正在测试的站点。它称为“ AcrosstheRoad.ttf”,可以在我的assets / fonts /文件夹中找到。我正在做以下尝试将其读入CSS文件:

@font-face {
  font-family: 'AcrosstheRoad';
  src: url('assets/fonts/AcrosstheRoad.ttf')  format('truetype');
}
Run Code Online (Sandbox Code Playgroud)

我想将其用作特定的标头类型,所以我正在使用

h3{
font-family: 'AcrosstheRoad';
color: #333;
}
Run Code Online (Sandbox Code Playgroud)

但是不幸的是字体没有加载。有人知道我在做什么错吗?

谢谢!克里斯蒂娜(Christina)

html css fonts

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

fonts ×1

html ×1