@font-face 不工作,无法将自定义字体添加到网站
@font-face not working, cannot add custom font to a website
我在向我的网站添加字体并将其应用于产品标题时遇到问题 -
110 死亡骑士之血 963
https://wowaccounts.eu/product/110dkblood950/
它不显示自定义字体,而是应用默认字体。
这是我 header 中样式 sheet 的 link:
<link rel="stylesheet" href="https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/stylesheet.css" type="text/css" charset="utf-8">
这就是样式 sheet:
@font-face {
font-family: 'lifecraftregular';
src: url('https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/lifecraft_font-webfont.woff2') format('woff2'),
url('https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/lifecraft_font-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
这就是我应用字体的方式:
h1.product_title.entry-title{
font-family: 'lifecraftregular';
}
我浪费了几个小时来找出问题所在...还没有结果。提前致谢!
如果您检查控制台,您可能会注意到两件事:
1)
Failed to load resource: the server responded with a status of 404
(Not Found)
和 2)
如果您在源选项卡中打开文件夹结构,您将不会像在 stylesheet.css 文件中那样找到字体文件(因此出现 404 错误)。
您定位的文本正确。我只是认为您的文件不在正确的文件夹中。重新访问您放置文件的确切位置。有没有可能是你把wowtheme文件夹错放到了默认的wordpress主题文件夹里了?
我在向我的网站添加字体并将其应用于产品标题时遇到问题 -
110 死亡骑士之血 963
https://wowaccounts.eu/product/110dkblood950/
它不显示自定义字体,而是应用默认字体。
这是我 header 中样式 sheet 的 link:
<link rel="stylesheet" href="https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/stylesheet.css" type="text/css" charset="utf-8">
这就是样式 sheet:
@font-face {
font-family: 'lifecraftregular';
src: url('https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/lifecraft_font-webfont.woff2') format('woff2'),
url('https://wowaccounts.eu/wp-content/themes/wowtheme/fonts/lifecraft_font-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
这就是我应用字体的方式:
h1.product_title.entry-title{
font-family: 'lifecraftregular';
}
我浪费了几个小时来找出问题所在...还没有结果。提前致谢!
如果您检查控制台,您可能会注意到两件事:
1)
Failed to load resource: the server responded with a status of 404 (Not Found)
和 2)
如果您在源选项卡中打开文件夹结构,您将不会像在 stylesheet.css 文件中那样找到字体文件(因此出现 404 错误)。
您定位的文本正确。我只是认为您的文件不在正确的文件夹中。重新访问您放置文件的确切位置。有没有可能是你把wowtheme文件夹错放到了默认的wordpress主题文件夹里了?