how to add custom font to react project
@font-face {
font-family: "AssistantRegular";
src: local("AssistantRegular"),
url("./fonts/assistant.regular.ttf") format("truetype");
font-weight: normal;
}
how to add custom font to react project
@font-face {
font-family: "AssistantRegular";
src: local("AssistantRegular"),
url("./fonts/assistant.regular.ttf") format("truetype");
font-weight: normal;
}
add font to react js
Create a folder called fonts under src
Download the required fonts into the src\fonts folder
Next, import the fonts into the index.js file.
import './fonts/Goldman/Goldman-Bold.ttf';
In the index.css file add,
@font-face {
font-family: "GoldmanBold";
src: local("GoldmanBold"),
url("./fonts/Goldman/Goldman-Bold.ttf") format("truetype");
font-weight: bold;
}
Now add a class name in the App.css file that uses this family name.
.font-face-gm {
font-family: "GoldmanBold";
}
Use this class name in your React component,
<div className="font-face-gm">
This is using Font Face.
</div>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us