所以我有一个在laravel的制作项目。我面临的问题是,当我上传自定义字体到公共目录(ttf,woff,woff2),然后在.css文件中指定@font系列时,当我检查元素为font-family时,它确实显示在CSS中,但字体实际上并没有改变。
@font-face {
src: url('/../fonts/custom-font.woff');
font-family: "custom-font" !important;
}
h1, h2, h3, h4, h5, h6 {
font-family: "custom-font" !important;发布于 2021-05-28 06:34:43
在我的例子中,我有几个问题。首先,我使用了不需要的!important,但最重要的是,我使用的字体格式错误。
@font-face {
src: url('/../fonts/custom-font.woff');
font-family: "custom-font";
}
h1, h2, h3, h4, h5, h6 {
font-family: "custom-font";
}它应该是这样的,并确保你仔细检查你正在使用的字体
https://stackoverflow.com/questions/67730497
复制相似问题