Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i import all google font at once?

I want help on importing all of Google web font at once , I tested the normal 'link rel' in my head tag to import The Family Tangerine for my post and it worked perfectly. Although i want a way in which i can import all the fonts available, so i can use them whenever i want , do i have to write them one by one or is there any full embedded link rel for all of them . Pease help me out.

like image 346
Bright umor Avatar asked Aug 03 '17 14:08

Bright umor


People also ask

Is it better to import or link Google Fonts?

Google Fonts provides the option to load fonts via <link> tags or an @import statement. The <link> code snippet includes a preconnect resource hint and therefore will likely result in faster stylesheet delivery than using @import version.


2 Answers

Hmm, it will result in an extremely large file being imported, and Google may even disallow it, but I guess you could select every font from the list. I've selected 101 of the fonts and it seems to work ok.

Go to https://fonts.google.com/ and start clicking every, single, font, and every, single, font weight (better get some food and drink ready, it might take a day or two) Google will provide a <link href="https://fonts.googleapis.com/css?family= with all the fonts appended. Add this to your page, then you can define the font-family for an element using any of the font names.

/*
font-family: 'Roboto', sans-serif;
font-family: 'Zilla Slab Highlight', cursive;
font-family: 'Open Sans', sans-serif;
font-family: 'Spectral', serif;
font-family: 'Slabo 27px', serif;
font-family: 'Lato', sans-serif;
font-family: 'Roboto Condensed', sans-serif;
font-family: 'Oswald', sans-serif;
font-family: 'Source Sans Pro', sans-serif;
font-family: 'Raleway', sans-serif;
font-family: 'Zilla Slab', serif;
font-family: 'Montserrat', sans-serif;
font-family: 'PT Sans', sans-serif;
font-family: 'Roboto Slab', serif;
font-family: 'Merriweather', serif;
font-family: 'Saira Condensed', sans-serif;
font-family: 'Saira', sans-serif;
font-family: 'Open Sans Condensed', sans-serif;
font-family: 'Saira Semi Condensed', sans-serif;
font-family: 'Saira Extra Condensed', sans-serif;
font-family: 'Julee', cursive;
font-family: 'Archivo', sans-serif;
font-family: 'Ubuntu', sans-serif;
font-family: 'Lora', serif;
font-family: 'Manuale', serif;
font-family: 'Asap Condensed', sans-serif;
font-family: 'Faustina', serif;
font-family: 'Cairo', sans-serif;
font-family: 'Playfair Display', serif;
font-family: 'Droid Serif', serif;
font-family: 'Noto Sans', sans-serif;
font-family: 'PT Serif', serif;
font-family: 'Droid Sans', sans-serif;
font-family: 'Arimo', sans-serif;
font-family: 'Poppins', sans-serif;
font-family: 'Sedgwick Ave Display', cursive;
font-family: 'Titillium Web', sans-serif;
font-family: 'Muli', sans-serif;
font-family: 'Sedgwick Ave', cursive;
font-family: 'Indie Flower', cursive;
font-family: 'Mada', sans-serif;
font-family: 'PT Sans Narrow', sans-serif;
font-family: 'Noto Serif', serif;
font-family: 'Bitter', serif;
font-family: 'Dosis', sans-serif;
font-family: 'Josefin Sans', sans-serif;
font-family: 'Inconsolata', monospace;
font-family: 'Bowlby One SC', cursive;
font-family: 'Oxygen', sans-serif;
font-family: 'Arvo', serif;
font-family: 'Hind', sans-serif;
font-family: 'Cabin', sans-serif;
font-family: 'Fjalla One', sans-serif;
font-family: 'Anton', sans-serif;
font-family: 'Cairo', sans-serif;
font-family: 'Playfair Display', serif;
font-family: 'Droid Serif', serif;
font-family: 'Noto Sans', sans-serif;
font-family: 'PT Serif', serif;
font-family: 'Droid Sans', sans-serif;
font-family: 'Arimo', sans-serif;
font-family: 'Poppins', sans-serif;
font-family: 'Sedgwick Ave Display', cursive;
font-family: 'Titillium Web', sans-serif;
font-family: 'Muli', sans-serif;
font-family: 'Sedgwick Ave', cursive;
font-family: 'Indie Flower', cursive;
font-family: 'Mada', sans-serif;
font-family: 'PT Sans Narrow', sans-serif;
font-family: 'Noto Serif', serif;
font-family: 'Bitter', serif;
font-family: 'Dosis', sans-serif;
font-family: 'Josefin Sans', sans-serif;
font-family: 'Inconsolata', monospace;
font-family: 'Bowlby One SC', cursive;
font-family: 'Oxygen', sans-serif;
font-family: 'Arvo', serif;
font-family: 'Hind', sans-serif;
font-family: 'Cabin', sans-serif;
font-family: 'Fjalla One', sans-serif;
font-family: 'Anton', sans-serif;
font-family: 'Acme', sans-serif;
font-family: 'Archivo Narrow', sans-serif;
font-family: 'Mukta Vaani', sans-serif;
font-family: 'Play', sans-serif;
font-family: 'Cuprum', sans-serif;
font-family: 'Maven Pro', sans-serif;
font-family: 'EB Garamond', serif;
font-family: 'Passion One', cursive;
font-family: 'Ropa Sans', sans-serif;
font-family: 'Francois One', sans-serif;
font-family: 'Archivo Black', sans-serif;
font-family: 'Pathway Gothic One', sans-serif;
font-family: 'Exo', sans-serif;
font-family: 'Vollkorn', serif;
font-family: 'Libre Franklin', sans-serif;
font-family: 'Crete Round', serif;
font-family: 'Alegreya', serif;
font-family: 'PT Sans Caption', sans-serif;
font-family: 'Alegreya Sans', sans-serif;
font-family: 'Source Code Pro', monospace;
*/
<link href="https://fonts.googleapis.com/css?family=Abel|Abril+Fatface|Acme|Alegreya|Alegreya+Sans|Anton|Archivo|Archivo+Black|Archivo+Narrow|Arimo|Arvo|Asap|Asap+Condensed|Bitter|Bowlby+One+SC|Bree+Serif|Cabin|Cairo|Catamaran|Crete+Round|Crimson+Text|Cuprum|Dancing+Script|Dosis|Droid+Sans|Droid+Serif|EB+Garamond|Exo|Exo+2|Faustina|Fira+Sans|Fjalla+One|Francois+One|Gloria+Hallelujah|Hind|Inconsolata|Indie+Flower|Josefin+Sans|Julee|Karla|Lato|Libre+Baskerville|Libre+Franklin|Lobster|Lora|Mada|Manuale|Maven+Pro|Merriweather|Merriweather+Sans|Montserrat|Montserrat+Subrayada|Mukta+Vaani|Muli|Noto+Sans|Noto+Serif|Nunito|Open+Sans|Open+Sans+Condensed:300|Oswald|Oxygen|PT+Sans|PT+Sans+Caption|PT+Sans+Narrow|PT+Serif|Pacifico|Passion+One|Pathway+Gothic+One|Play|Playfair+Display|Poppins|Questrial|Quicksand|Raleway|Roboto|Roboto+Condensed|Roboto+Mono|Roboto+Slab|Ropa+Sans|Rubik|Saira|Saira+Condensed|Saira+Extra+Condensed|Saira+Semi+Condensed|Sedgwick+Ave|Sedgwick+Ave+Display|Shadows+Into+Light|Signika|Slabo+27px|Source+Code+Pro|Source+Sans+Pro|Spectral|Titillium+Web|Ubuntu|Ubuntu+Condensed|Varela+Round|Vollkorn|Work+Sans|Yanone+Kaffeesatz|Zilla+Slab|Zilla+Slab+Highlight" rel="stylesheet">

An alternate, and much more performant solution, might be to use the Google Web Font Loader which allows you to load any of the Google fonts via JS. This would allo you to load ANY of the Google fonts, without loading ALL of the Google fonts.

<script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js">    </script>
<script>
  WebFont.load({
    google: {
      families: ['Any Google Font']
    }
  });
</script>
like image 151
Brett DeWoody Avatar answered Sep 19 '22 12:09

Brett DeWoody


You can import all Google Fonts to your website using the Easy Fonts library. All you have to do is import the following CSS file:

<link href="https://pagecdn.io/lib/easyfonts/fonts.css" rel="stylesheet" />

and, then use the fonts the way you want. Additionally, you can also use the font families and font weights using CSS classes as below:

<div class="font-lato w500i">
    <a class="font-open-sans w700" href="https://google.com">Google</a>
</div>

Full class reference for each font family is available here.

like image 31
Hamid Sarfraz Avatar answered Sep 22 '22 12:09

Hamid Sarfraz