简体   繁体   English

如何在自定义 CSS 部分的 Wordpress 中设置字体?

[英]How to set font in Wordpress in Custom CSS section?

Running Wordpress with AWS Lightsail.使用 AWS Lightsail 运行 Wordpress。 This is the location of the uploaded font.这是上传字体的位置。 I would use it for certain text.我会将它用于某些文本。

在此处输入图像描述

Tried this:试过这个:

@font-face {
    font-family: 'Icons';
    src: url(/icons.ttf);
    font-weight: normal;
    font-style: normal;
}

and this to define:这要定义:

@font-face {
    font-family: 'Icons';
    src: url(/et-fonts/icons.ttf);
    font-weight: normal;
    font-style: normal;
}

none worked.没有工作。 What is wrong?怎么了?

This is which I would apply for:这是我要申请的:

<span
  style={{ fontFamily: "Icons", fontSize: "2rem", cursor: "pointer" }}
>
  c
</span>;

Ok, this is it:好的,就是这样:

@font-face {
    font-family: 'Icons';
    src: url(/wp-content/uploads/et-fonts/icons.ttf);
    font-weight: normal;
    font-style: normal;
}

you should do like this.你应该这样做。

theme folder >> font folder >> font.ttf主题文件夹>>字体文件夹>>字体.ttf

Please just remove first "/" in url.请删除网址中的第一个“/”。

@font-face {
    font-family: 'Icons';
    src: url(/et-fonts/icons.ttf);
    font-weight: normal;
    font-style: normal;
}

change to改成

@font-face {
    font-family: 'Icons';
    src: url(et-fonts/icons.ttf);
    font-weight: normal;
    font-style: normal;
}

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

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