Languages
[Edit]
EN

CSS - Google Fonts

3 points
Created by:
MindOfMadness3
696

In this article, we would like to show you how to use Google Fonts working with CSS.

Quick solution:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap" rel="stylesheet">
  <style>
    
    body {
        font-family: 'Roboto', sans-serif;
    }
    
  </style>
</head>
<body>
  Example text...
</body>
</html>

 

Detailed explanation

1. Go to the Google Fonts page and choose your font.

CSS - choose Google Font
CSS - choose Google Font

2. Select the font style and open View your selected families.

CSS - select Google Font style
CSS - select Google Font style

3. Copy and paste link elements to the <head> of your HTML, and assign the CSS rules into the element where you want to place the font.

CSS - copy Google Font code to your HTML
CSS - copy Google Font code to your HTML

References

  1. Browse Fonts - Google Fonts

Alternative titles

  1. CSS - how to use Google Fonts
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join