I would like to use Google Fonts in React. I am using
import 'https://fonts.googleapis.com/css?family=Josefin+Sans';
in App.js and
font-family: 'Josefin Sans', cursive;
in the component.css and I am getting a failed to compile error.
I would like to use Google Fonts in React. I am using
import 'https://fonts.googleapis.com/css?family=Josefin+Sans';
in App.js and
font-family: 'Josefin Sans', cursive;
in the component.css and I am getting a failed to compile error.
AFAIK you CAN'T import files from URL. You have to host it in local (grab the entire file), or include it in your page's header as you'd do with another "basic" stylesheet.
Use the @import
syntax in your component.css
.
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans');
Dylan
go to component.css
for local font :
@font-face {
src: url('./fonts/Report-Bold.ttf') format('ttf');
}
for google font:
@import url('https://fonts.googleapis.com/css?family=Oswald&display=swap');