reactjs font family code example

Example 1: import google fonts into react

@import url('https://fonts.googleapis.com/css?family=Patrick+Hand+SC|Roboto&display=swap');

body {
  font-family: 'Patrick Hand SC', cursive;
}

Example 2: how to add google fonts to css in react

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@700&display=swap');
at the top of css file

Example 3: font family react

If you want to effect the font of all text on all pages. Simply replace :root with *. The * selector effects everything on the given page.

Make sure to import your css file into every react page you want it to take effect on.

Tags:

Misc Example