字体
如何使用字体:
css
@font-face {
font-family: "HarmonySans"; /* 自定义字体名称(后续调用用) */
/* 按优先级排序:woff2 → woff → ttf */
src: url("../common/font/HarmonySansScRegular.ttf") format("truetype");
font-weight: 400; /* 字体粗细(normal) */
font-style: normal; /* 字体样式(正常) */
font-display: swap; /* 优化加载:先显示默认字体,字体加载完成后替换 */
}
@font-face {
font-family: "AlimamaDongFangDaKai"; /* 自定义字体名称(后续调用用) */
/* 按优先级排序:woff2 → woff → ttf */
src: url("../common/font/AlimamaDongFangDaKai-Regular.woff2") format("woff2"),
url("./common/font/AlimamaDongFangDaKai-Regular.woff") format("woff"),
url("./common/font/AlimamaDongFangDaKai-Regular.ttf") format("truetype");
font-style: normal; /* 字体样式(正常) */
font-display: swap; /* 优化加载:先显示默认字体,字体加载完成后替换 */
}免费字体:
- iconfont https://www.iconfont.cn/fonts/index
- 华为字体 https://developer.huawei.com/consumer/cn/design/resource-V1/
- oppo 字体 https://www.coloros.com/article/A00000074/
- vivo 字体 https://developers.vivo.com/doc/d/314fa33cbaec4a93be351cd44757d9d9
使用示例:
scss
.detail-content {
font-size: 22px;
color: #2b2b2b;
line-height: 1.8;
letter-spacing: 1px;
font-family: HarmonySans, AlimamaDongFangDaKai, Helvetica Neue, Helvetica, PingFang
SC, Tahoma, Arial, sans-serif;
video,
img {
max-width: 100%;
height: auto;
}
.ck-content {
font-family: HarmonySans, AlimamaDongFangDaKai, Helvetica Neue, Helvetica, PingFang
SC, Tahoma, Arial, sans-serif;
}
}