In my react project created using create-react-app
, I put a font file called CaviarDreams.ttf
inside my /asset
folder.
In the default index.css
file, I did like this:
@font-face {
font-family: 'CaviarDreams';
src: url('assets/CaviarDreams.ttf') format('truetype'),
}
body {
margin: 0;
font-family: "CaviarDreams";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: #f2f2f2;
}
However, the font doesn't change at all.
I also tried in the App.css
, but it's still the same.
Am I doing something wrong?