1

Hey i want to add some custom fonts from files.

These are the font files that i want to load.

These are the font files

My index.css

body {
  margin: 0;
  padding: 0;
}

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500&display=swap");

@tailwind base;
@tailwind components;

@tailwind utilities;

Thanks in advance

Niklas
  • 119
  • 5
  • Maybe take a look at this Q/A https://stackoverflow.com/questions/41676054/how-to-add-fonts-to-create-react-app-based-projects – AJK Mar 04 '22 at 21:47

1 Answers1

1

If you don't mind spending time getting the relative path to each of the fonts, you can do this

/* local if the font is installed */
@font-face {
    font-family: 'Font Name';
    src: local('Font Name'), url("./FontName.ttf") format('truetype');
}
Goose
  • 48
  • 6
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 04 '22 at 23:56