@ font-face没有在Wordpress中加载

时间:2017-01-03 22:57:01

标签: css wordpress font-face

我在Wordpress中的子主题中包含了一些.ttf字体。我也有两个独立的开发环境,它们是相同的。在一个中,字体加载得很好,但在另一个字体中根本不会加载。我查看了inspect元素中的错误并看到:

获取http://thedomain.com/wp-content/themes/theme-child/fonts/Alice-Regular.ttf 它甚至没有说" 404"无法加载,并进一步声明这行代码在索引页面上,而实际上是在子主题的style.css文件中。

对于我的所有非谷歌字体,这就是它们发生的事情......但仅限于一个环境。路径是100%正确的,我已经放了一个" /"在路径前面,把它取下来,我做了绝对的路径,几乎所有的音乐椅都可以用路径做。

我已经清除了缓存,缓存已破坏,以及所有这些,但字体只是不加载。

这是CSS(我的第一个环境工作),是的,'字体' folder与style.css位于同一目录中 我甚至从文件夹中取出字体并将它们放在与style.css相同的目录中,并相应地调整CSS中的路径 - 不用了。

public abstract class Component
{
    public abstract void Operation();
}

public class ConcreteComponent1 : Component
{
    public override void Operation()
    {
        //logic
    }
}

public abstract class ComponentDecorator : Component
{
    protected readonly Component Component;

    protected ComponentDecorator(Component component)
    {
        Component = component;
    }

    public override void Operation()
    {
        if(Component != null)
            Component.Operation();
    }
}

public class ConcreteDecorator : ComponentDecorator
{
    public ConcreteDecorator(Component component) : base(component)
    {
    }

    public override void Operation()
    {
        base.Operation();
        Console.WriteLine("Extend functionality");
    }
}

1 个答案:

答案 0 :(得分:0)

以下是您需要了解的相关文件路径:

Starting with "/" returns to the root directory and starts there
Starting with "../" moves one directory backwards and starts there
Starting with "../../" moves two directories backwards and starts there (and so on...)
To move forward, just start with the first subdirectory and keep moving forward

使用@ font-face https://css-tricks.com/snippets/css/using-font-face/