How to use Google Fonts with CSS Tutorial

Googles fonts API “makes it quick and easy for everyone to use web fonts” and is very simple to use. There are many advantages to using Google fonts because you get to use elegant fonts on your website that have been tested on hundreds of browser configurations and googles content delivery system can reassure you that users will always be able to load the fonts.

There’s essentially 2 steps to integrating a Google font into your website. First you include the stylesheet then you assign the font to the elements on your page that you want to use it, and that’s it! There are two more options you can customize to fit your needs if you want additional font styles or character sets.

Join us in our newest publication:

After you’ve found a font you like from Google Fonts and clicked the quick use button you’ll see 4 options. The first is where you choose your styles, which usually include light, normal, bold, and super bold options. Next you’ll choose your character sets such as latin, greek, and vietnamese. The third step is where you copy the code to include the font on your page. Google gives three options on including the font.

The standard option is your traditional <link> tag that you include in your <head> tag.

<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

The @import option allows you to include the single line in another CSS document that is already included in the <head> of your website.

Finally the Javascript option allows you to include the styling through a javascript function.

The last step is assigning the font families to elements on your page. Assign the font using the font-family tag and the name of the font you selected, just like any other font. Make sure to include a fallback font just to be safe!

font-family: 'Open Sans', sans-serif;

Share and Enjoy !

0Shares
0 0