【发布时间】:2020-08-10 07:10:50
【问题描述】:
为Amstelvar 斜体(可变)字体定义@font-face 声明的正确方法是什么?
这是我使用的字体声明:
@font-face {
font-family: 'Amstelvar';
font-weight: 100 900;
font-display: swap;
font-style: normal;
src: url('amstelvar-roman.woff2') format('woff2-variations'),
url('amstelvar-roman.woff2') format('woff2');
}
@font-face {
font-family: 'Amstelvar';
font-weight: 100 900;
font-display: swap;
font-style: oblique 0deg 10deg;
src: url('amstelvar-italic.woff2') format('woff2-variations'),
url('amstelvar-italic.woff2') format('woff2');
}
添加这是我应用于斜体文本的类:
.italic {
font-style: italic,
@supports (font-variation-settings: normal): {
font-variation-settings: 'slnt' -10,
font-style: oblique 10deg,
}
}
这里是live example。 italic 一词必须在“带有斜体和粗体的测试页”标题中斜体,但不幸的是,它没有任何效果。
【问题讨论】:
标签: html css fonts font-face webfonts