[英]Add custom font css with @font-face NOT WORKING
I'm trying to load a custom font from [DaFont.com (CaviarDreams)][1], with @font-face in css.我正在尝试从 [DaFont.com (CaviarDreams)][1] 加载自定义字体,并在 css 中使用 @font-face。 I use this: https://www.fontsquirrel.com/tools/webfont-generator and I get this in css:
我使用这个: https : //www.fontsquirrel.com/tools/webfont-generator我在css中得到了这个:
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on July 13, 2018 */ @font-face { font-family: 'caviar'; src: url('font/caviardreams-webfont.eot'); src: url('font/caviardreams-webfont.eot?#iefix') format('embedded-opentype'), src: url('font/caviardreams-webfont.woff2') format('woff2'), src: url('font/caviardreams-webfont.woff') format('woff'), src: url('font/caviardreams-webfont.svg#caviar_dreamsregular') format('svg'); font-weight: normal; font-style: normal; } p { font-size:40px; font-family:caviar; }
<!DOCTYPE html> <html lang="fr-FR"> <head> <title>test</title> <link rel="stylesheet" href="styles.css"> <meta charset="UTF-8"> </head> <body> <p>test<p> </body> </html>
But it don't work!但它不起作用!
(edited) Can you help me? (编辑)你能帮我吗?
So after testing it on my site I have found a few issues:因此,在我的网站上对其进行测试后,我发现了一些问题:
My code fo one example:我的一个例子的代码:
<style>
@font-face {
font-family: 'caviar';
src: url('font/caviardreams-webfont.woff2') format('woff2');
src: url('font/caviardreams-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
p{
font-family:caviar;
font-weight:normal;
font-style:normal;
}
</style>
<div>
<p>Test</p>
</div>
Hope this helps,希望这可以帮助,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.