繁体   English   中英

如何为自定义magento主题添加新字体?

[英]How to add new font to custom magento theme?

我试图将新字体添加到自定义的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>

谁能帮我解决这个问题?

我试图将新字体添加到自定义的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 */
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM