Search code examples
csshtmlfontsgoogle-webfonts

How to connect google font to page?


I have used recommendations in Google Fonts how to set fonts. So I did the following actions:

1) Added this ependency on the page:

<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700&amp;subset=cyrillic-ext" rel="stylesheet">

2) Set CSS to body tag:

 html, body {
        font-family: 'Roboto', sans-serif;
        background: #f7f7f7;
    }

When I tried to set font for another elements like:

a {
font-family: Roboto-Light;
}

It does not work.

enter image description here


Solution

  • a {
       font-family: 'Roboto'; /* You don't need this since you say html {font-family: 'Roboto'}*/
       font-weight: 100;
    }
    /*Font's family name need to be inside quotes "MyFontName"