Search code examples
htmlcssfontsgoogle-font-api

How to use a Google Font once it is installed on your machine


So I know this is a very newbie question but I cant seem to figure this out, don't know what I am doing wrong here. Downloaded a font from Google Fonts, installed it on my machine and am referencing it in my css like this:

* { margin:0; padding:0; font-family:Lobster; }

In my html I just have a p tag:

<p> Hi, this is some text</p>

Are there any extra steps that need to be taken to use a google font installed on your local machine ??


Solution

  • The correct syntax to use a font is font-family:'Lobster', Arial; Here if the Lobster font is not available it will use the Arial.

    Also you can just import a font file in the css.

    CSS

    @import url(//fonts.googleapis.com/css?family=Lobster:400);
    body{ font-family:'Lobster', Arial; }
    

    DEMO