Man*_*eru 5 html css fonts webfonts
我在我的网站中使用了许多网络字体,现在我想添加具有 serif/sans-serif/monospace 类型字体的新字体系列。我的CSS的一部分:
@font-face {
font-family: 'DejaVu', sans-serif;
font-weight: 400;
font-style: normal;
src: url(dejavu/DejaVuSans.ttf)
}
@font-face {
font-family: 'DejaVu', monospace;
font-weight: 400;
font-style: normal;
src: url(dejavu/DejaVuSansMono.ttf);
}
@font-face {
font-family: 'DejaVu', serif;
font-weight: 400;
font-style: normal;
src: url(dejavu/DejaVuSerif.ttf);
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用(在 css 控制台中,我看到如下错误:字体系列的值不正确)。有什么方法可以让它只使用一个字体名称。
我知道我可以将字体系列名称更改为:“DejaVu Serif”,但我不想这样做。
答案是否定的,唯一的方法是更改名称font-family以包含字体定义。
您可以设置font-style或font-weight并使用它们来选择您的,font-face但不能堆叠font-face家庭。