我正在尝试使用一种名为“ Patua One”的字体,但是当我在CSS中添加属性时,更改未显示。
这是我的CSS代码:
.p1{
font-family: "Patua One";
font-size: 70px;
color: #1B423E;
}
这就是我的导入内容:
@font-face {
font-family: 'patua_oneregular';
src: url('patuaone-regular-webfont.eot');
src: url('patuaone-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('patuaone-regular-webfont.woff') format('woff'),
url('patuaone-regular-webfont.ttf') format('truetype'),
url('patuaone-regular-webfont.svg#patua_oneregular') format('svg');
font-weight: normal;
font-style: normal;
}
如果您想知道,src:url('patuaone-regular-webfont')位于我的webroot中,它包含所有这些文件。
这是我的根目录
然后在webfontkit中是这些文件:
在style.css里面是我上面发布的@import CSS。
最佳答案
导入和使用时,您的font-family
应该具有一致的值。
另外,您没有提供字体文件的正确路径。
它应该是:
@font-face {
font-family: 'patua_oneregular';
src: url('../webfontkit-patuaone/patuaone-regular-webfont.eot');
src: url('../webfontkit-patuaone/patuaone-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../webfontkit-patuaone/patuaone-regular-webfont.woff') format('woff'),
url('../webfontkit-patuaone/patuaone-regular-webfont.ttf') format('truetype'),
url('../webfontkit-patuaone/patuaone-regular-webfont.svg#patua_oneregular') format('svg');
和
.p1{
font-family: 'patua_oneregular';
}