how to import fonts google fonts code example

Example 1: add google font

CSS
@import url(https://fonts.googleapis.com/css?family=Roboto);

HTML
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto"/>

body{
  font-family: "Roboto";
}

Example 2: google font import

<!-- To import google font add this to the head of your HTML then you can use use the imported font family in your CSS file -->

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" rel="stylesheet">

Example 3: use google font in html

body {
    font-family: '*Insert google font';font-size: 22px;
}

Tags:

Css Example