默认情况下,可以实现不同的字体、字体权重和样式,以便稍后在我的css样式设置中使用:
@font-face {
font-family: "My Font Family";
src: url("fonts/my-font-family-regular.ttf");
font-weight: regular;
}
@font-face {
font-family: "My Font Family";
src: url("fonts/my-font-family-bold.ttf");
font-weight: bold;
}
现在我确实想添加一个light
和一个medium
版本:
@font-face {
font-family: "My Font Family";
src: url("fonts/my-font-family-light.ttf");
font-weight: 200;
}
@font-face {
font-family: "My Font Family";
src: url("fonts/my-font-family-medium.ttf");
font-weight: 500;
}
但这对我不起作用。是否有关于字体权重值的约定?
发布于 2016-09-01 15:30:28
编辑
如果只需要一个font
名称,则可以使用class
es设置一个字体集weight
。
@font-face {
font-family: "myFont";
src: url("fonts/my-font-family-light.ttf");
font-weight: 200;
}
.s1{
font-family: myFont;
font-weight: 200;
}
.s2{
font-family: myFont;
font-weight: 400;
}
.s3{
font-family: myFont;
font-weight: 600;
}
否则,为每个元素指定不同的名称。
@font-face {
font-family: "myLightFont";
src: url("fonts/my-font-family-light.ttf");
font-weight: 200;
}
@font-face {
font-family: "myMediumFont";
src: url("fonts/my-font-family-medium.ttf");
font-weight: 500;
}
查看w3schools以获得更多信息
发布于 2016-09-01 15:30:12
是的,有不同的字体重量值,如果你随机使用任何值,它将不会反映,因为它们只给出相同的结果。
喜欢
如果你给价值(100 200 300 400 500 600 700 800 900)
然后,它将定义字体权重属性瘦到粗字符。400将与正常相同,700将与粗体相同。
p.normal {
font-weight: normal;
}
p.light {
font-weight: lighter;
}
p.thick {
font-weight: bold;
}
p.thicker {
font-weight: 900;
}
输出:
参考: 单击此处
https://stackoverflow.com/questions/39275536
复制相似问题