简体   繁体   中英

How to set font in Wordpress in Custom CSS section?

Running Wordpress with AWS Lightsail. 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

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;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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