Google WebFonts Jump Start PRO

Google WebFonts API provides us with hundreds of open source fonts we can use in our web page. We can easily search through the web fonts collection and select the ones we want to use.

The following code sample shows how simple it is to use these fonts in our web page by adding a code snippet in JavaScript that dynamically loads the fonts we picked.

<html>
<head>
    <script type="text/javascript">
        WebFontConfig = {
            google: { families: [ 'Magra::latin', 'Titan+One::latin' ] }
        };
        (function() {
            var wf = document.createElement('script');
            wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
                    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
            wf.type = 'text/javascript';
            wf.async = 'true';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(wf, s);
        })(); </script>
    <style>
        body {
            font-family: 'Titan One';
            font-size: 52px;
        }
    </style>
</head>
<body>
<div>We Love Programming</div>
</body>
</html>

The following code sample shows how simple it is to add the fonts we picked by adding a @import statement into our CSS.

<html>
<head>
    <style>
        @import url(http://fonts.googleapis.com/css?family=Magra|Titan+One);
        body {
            font-family: 'Titan One';
            font-size: 52px;
        }
    </style>
</head>
<body>
<div>We Love Programming</div>
</body>
</html>

The following code sample shows how simple it is to add the fonts we picked by adding a CSS link to our web page.

<html>
<head>
    <link href='http://fonts.googleapis.com/css?family=Magra|Titan+One' rel='stylesheet' type='text/css'>
    <style>
        body {
            font-family: 'Titan One';
            font-size: 52px;
        }
    </style>
</head>
<body>
<div>We Love Programming</div>
</body>
</html>

The following video clip overviews the above mentioned three techniques for adding fonts into our web page and explains each and every one of them.

You can find more resources for learning how to use Google WebFonts API in my free courses website at http://abelski.lifemichael.com.

Share:

The Visitor Design Pattern

The Visitor Design Pattern

The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.

What are Anti Patterns?

Anti Patterns

Unlike design patterns, anti patterns just seem to be a solution. However, they are not a solution and they cause additional costs.

Virtual Threads in Java Professional Seminar

Virtual Threads in Java

The use of virtual threads can assist us with improving the performance of our code. Learn how to use virtual threads effectively.

NoSQL Databases Courses, Seminars, Consulting, and Development

MongoDB Design Patterns Meetup

The use of MongoDB involves with various cases in which we can overcome performance issues by implementing specific design patterns.

image of woman and database

Record Classes in Java

Learn how to define record classes in Java, and when to use record classes in your code. Stay up to date with the new Java features.

Accessibility | Career | Conferences | Design Patterns | JavaScript | Meetups | PHP | Podcasts | Python | Self Learning

Teaching Methodologies | Fullstack | C++ | C# | CSS | Node.js | Angular | Java | Go | Android | Kotlin | Swift | Academy

Front End Development | Scala | Architectures | Cloud | Big Data | Internet of Things | Kids Learn Programming

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Skip to content Update cookies preferences