Css @字体面在文件夹中找不到字体

Css @字体面在文件夹中找不到字体,css,font-face,webfonts,Css,Font Face,Webfonts,我试图让@font-face在位于public\u html/evansopen文件夹中的子域中工作。我有网站运行。我想把fontsquirrel文件放在evansopen/fonts中,但如果我没有将它们放在styles.css和index.php(公共的html/evansopen文件夹)的同一位置,它们就不会加载。目前它以这种方式运行良好,但我喜欢保持文件结构干净 我可以从/evansopen/images/put_green_footer.gif文件夹中获取要加载的图像,这样就不会出现问

我试图让@font-face在位于public\u html/evansopen文件夹中的子域中工作。我有网站运行。我想把fontsquirrel文件放在evansopen/fonts中,但如果我没有将它们放在styles.css和index.php(公共的html/evansopen文件夹)的同一位置,它们就不会加载。目前它以这种方式运行良好,但我喜欢保持文件结构干净

我可以从/evansopen/images/put_green_footer.gif文件夹中获取要加载的图像,这样就不会出现问题

#footer {
    background-image: url(images/putting_green_footer.gif); background-repeat: repeat;
}
为什么我不能让@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;
}

我对此做了不少研究。如果这是一篇多余的帖子,我很抱歉。

使用
fontface

您的CSS文件(domain.com/path/custom font.CSS)

你的字体文件必须上传到

domain.com/path/字体/nexa\u light-webfont.ttf

比如说

PS:这是关于你的
css
文件的位置,所以在相同的css文件路径中创建一个
/font/
文件夹


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

如果您的字体文件夹与css文件不在同一文件夹中,那么这将不起作用。我猜您的fonts文件夹已从主www文件夹中拆分,因此请尝试/fonts/nexa_light-webfont.eot而不是fonts/nexa_light-webfont.eot。fonts文件夹与style.css文件位于同一位置。路径是:public_html/evansopen/styles.css&public_html/evansopen/fonts/nexa_light-webfont.eot。我会尝试输入字体文件的完整路径,比如,而且我不相信字体系列需要引号:“nexa_lightregular”;尝试字体系列:nexa_lightregular;我的字体文件夹与styles.css位于同一位置。路径是:public_html/evansopen/styles.css和public_html/evansopen/fonts/nexa_light-webfont.eot子域是什么?还有儿童主题?我把一些网站放在子域中,并使用一个子主题。
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;