【问题标题】:How to add new font to custom magento theme?如何为自定义 magento 主题添加新字体?
【发布时间】:2014-07-04 04:51:54
【问题描述】:

我尝试将新字体添加到我的自定义 magento 主题中,但不包含在字体中。但它不起作用。

这是我使用的 CSS。

@font-face {
    font-family: font-one;
    src: url(../../CoCo/magento/skin/frontend/default/master/fonts/Pacifico.ttf);
}

.font-one{
font-family: font-one;
color:#b02c1d;
}

我将字体文件放在皮肤 mytheme 文件夹中。这就是我添加它的方式。

<h3 class="top font-one">-- New --</h3>

谁能帮我纠正这个问题?

【问题讨论】:

标签: css magento fonts


【解决方案1】:

我尝试将新字体添加到我的自定义 magento 主题

您应该在模板文件夹中包含.ttf 文件。喜欢:

skin/frontend/default/{theme_name}

从您的问题观察来看,您的自定义主题名称似乎是“master”。

您提到的字体声明的网址是:

../../CoCo/magento/skin/frontend/default/master/fonts/Pacifico.ttf

我确定您提到的用于声明 font-face 的 url 是错误的,因为它超出了项目文件夹。

让我用一个例子来解释一下在这种情况下如何设置一个 url:

为了解释,我假设您的 {custom_theme} 的以下目录用于皮肤。

skin/frontend/default
    --> {custom_theme_name}     #which is 'master', I think
         --> fonts
             --> Pacifico.ttf
         --> CSS
             --> main.css

例如,如果您在main.css 中声明新的字体,那么它应该是这样的:

@font-face {
    font-family: font-one;
    src: url(../fonts/Pacifico.ttf);  /* check this */
}

【讨论】:

    猜你喜欢
    • 2014-05-23
    • 1970-01-01
    • 2013-01-09
    • 1970-01-01
    • 2012-02-05
    • 2019-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多