可以使用单个 @font-face 查询定义多个字体粗细吗?
Klavika 字体有各种粗细和形状。可以使用指定粗细的单个 @font-face 查询将这些导入到 CSS 中吗?
解决方案:
引入 @font-face 的多功能功能,您可以可以将不同的样式和粗细与单个字体系列名称相关联:
@font-face { font-family: "DroidSerif"; src: url("DroidSerif-Regular-webfont.ttf") format("truetype"); /* Normal weight, normal style */ src: url("DroidSerif-Italic-webfont.ttf") format("truetype"); /* Normal weight, italic style */ src: url("DroidSerif-Bold-webfont.ttf") format("truetype"); /* Bold weight, normal style */ src: url("DroidSerif-BoldItalic-webfont.ttf") format("truetype"); /* Bold weight, italic style */ }
您现在可以为不同元素指定 font-weight:bold 或 font-style:italic:
body { font-family:"DroidSerif", Georgia, serif; } h1 { font-weight:bold; } em { font-style:italic; } strong em { font-weight:bold; font-style:italic; }
有关此功能的全面详细信息,请参阅官方文档。
示例:
[Example Pen](https://codepen .io/anon/pen/EjxVqv)
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3