所以我在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;
在我的案例中,我遇到了几个问题。首先,我有!important
,这是不需要的,但最重要的是,我使用的字体格式错误。
@font-face {
src: url('/../fonts/custom-font.woff');
font-family: "custom-font";
}
h1, h2, h3, h4, h5, h6 {
font-family: "custom-font";
}
它应该是这样的,并确保你仔细检查字体你正在使用