为什么我不能实现@ font-face? [英] Why Can I Not Implement @font-face?

查看:448
本文介绍了为什么我不能实现@ font-face?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是当使用 @ font-face 时,自定义字体不显示。



我的CSS是引用它自己的文件和代码是:

  @ font-face {
font-family:'MerceariaAntique' ;
src:url('type / mercearia_new / 21319b_0_0-mercearia.eot');
src:url('type / mercearia_new / 21319b_0_0-mercearia.eot?#iefix')format('embedded- opentype'),
url('type / mercearia_new / 21319b_0_0-mercearia.woff')格式('woff'),
url('type / mercearia_new / 21319b_0_0-mercearia.ttf')格式('truetype'),
url('type / mercearia_new / 21319b_0_0-mercearia.svg#webfontuploaded_file ')格式('svg');
font-weight:normal;
font-style:normal;



$ b

在我的HTML文件中,我将它引用为主CSS文件:

 < link rel =stylesheettype =text / cssmedia =allhref =css / fonts.css/> 

我怀疑我的引用不正确,但是我找不到如何正确引用它。

解决方案

您的文件夹结构如何?
如果你在一个文件夹css中调用css,你必须指出正确的路径到自定义字体
像这样../\"

  src:url('../ type / mercearia_new / 21319b_0_0-mercearia.eot'); 


My problem is that custom fonts do not display when using @font-face.

My CSS is referenced in it's own file and the code is:

@font-face {
    font-family: 'MerceariaAntique';
    src: url('type/mercearia_new/21319b_0_0-mercearia.eot');
    src: url('type/mercearia_new/21319b_0_0-mercearia.eot?#iefix') format('embedded-    opentype'),
         url('type/mercearia_new/21319b_0_0-mercearia.woff') format('woff'),
         url('type/mercearia_new/21319b_0_0-mercearia.ttf') format('truetype'),
         url('type/mercearia_new/21319b_0_0-mercearia.svg#webfontuploaded_file')     format('svg');
    font-weight: normal;
    font-style: normal;
    }

In my HTML file I have referenced it as the following alongside the main CSS file:

<link rel="stylesheet" type="text/css" media="all" href="css/fonts.css" />

I suspect I have referenced it incorrectly, but I can't find out how to reference it correctly.

解决方案

what is your folder structure?? if you calling css inside a folder "css" you must point out the correct path to custom fonts like this "../"

src: url('../type/mercearia_new/21319b_0_0-mercearia.eot');

这篇关于为什么我不能实现@ font-face?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆