简体   繁体   中英

Font Not applying in React Application

I am importing fonts from google fonts and applying that fonts on all elements of index page.

But not applying these fonts

In index.html

<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">

index.css

 .body {
  margin: 0;
  padding: 0;
  font-family: 'Press Start 2P'; }

See this works, maybe you are trying to change in the body tag, replace .body with body

 @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap'); body { margin: 0; padding: 0; font-family: 'Press Start 2P', cursive; }
 Hello World!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM