@ font-face找不到文件夹中的字体

Fit*_*mx6 4 css webfonts font-face

我想让@ font-face在位于public_html/evansopen文件夹中的子域中工作.我有网站http://coryfitzpatrick.com/evansopen/正在运行.我想将fontsquirrel文件放在evansopen/fonts中,但是当我没有它们与styles.css和index.php(public_html/evansopen文件夹)相同的位置时它们不会加载.它目前运行良好,但我喜欢保持我的文件结构清洁.

我可以从/evansopen/images/putting_green_footer.gif文件夹中加载图像,没有这样的问题

#footer {
    background-image: url(images/putting_green_footer.gif); background-repeat: repeat;
}
Run Code Online (Sandbox Code Playgroud)

为什么我不能让@ font-face直接指向evansopen/fonts /?

@font-face {
    font-family: 'nexa_lightregular';
        src: url('fonts/nexa_light-webfont.eot');
        src: url('fonts/nexa_light-webfont.eot?#iefix') format('embedded-opentype'), 
             url('fonts/nexa_light-webfont.woff') format('woff'),
             url('fonts/nexa_light-webfont.ttf') format('truetype'),
             url('fonts/nexa_light-webfont.svg#nexa_lightregular') format('svg');
    font-weight: normal;
    font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

我对此进行了相当多的研究.对不起,如果这是一个多余的帖子.

l2a*_*lba 5

使用示例 fontface

你的CSS文件(domain.com/path/custom-font.css)

font-family: 'nexa_lightregular';
      src: url('fonts/nexa_light-webfont.eot');
      src: url('fonts/nexa_light-webfont.eot?#iefix') format('embedded-opentype'), 
           url('fonts/nexa_light-webfont.woff') format('woff'),
           url('fonts/nexa_light-webfont.ttf') format('truetype'),
           url('fonts/nexa_light-webfont.svg#nexa_lightregular') format('svg');
font-weight: normal;
font-style: normal;
Run Code Online (Sandbox Code Playgroud)

您的字体文件必须上传

domain.com/path/ fonts /nexa_light-webfont.ttf

例如

PS:这是关于你的css文件在哪里,所以/fonts/在同一个CSS文件路径中创建一个文件夹.

EX:domain.com/mycss.css - > domain.com/fonts/myfont.ttf