</> Code The Pixel

Using Google Font in Website

Asyraf Wahi Anuar - February 05, 2022

Estimated reading time: 1 minute, 29 seconds

Google Fonts is a free Google service that provides access to thousands of fonts. All of the fonts are available under an open-source license. This is very useful for developers which enables them to apply different types of font faces directly from the Google Font API. Google Font also allow users to download the font and use it offline. This tutorial will provide the steps to apply Google Font to your website.

Browsing and Select Fonts
Navigate to Google Font. You can browse or search the specific font using the searching toolbar. Click the selected font and you are required to choose the font style (eg thin, regular, medium, bold). Once you made the decision, click ‘+ select this style’. Then it will be loaded into the selected font family panel. It is possible to add more than one font type and style. 

Google Font

Adding Google Font To Web
Include the Google Font link into the <head> section and the CSS style. You also can apply the font CSS in external CSS.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Code The Pixel</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
        font-family: 'Roboto', sans-serif;
  <h1>Code The Pixel. Google Font</h1>

That's all. Now you can use the Google Font on your web.

Cite this article (APA 6th Edition)

PHP: Estimate Reading Time
June, 20 2020
CakePHP 4 Print PDF Using CakePDF
May, 17 2020
CakePHP 4 Authentication Using Auth...
May, 14 2020
CakePHP 4 Sending Email
February, 01 2022
CakePHP 4 Export To CSV
May, 29 2020
CakePHP 4 jQuery Date Time Picker
October, 01 2018
CakePHP 4 Authentication Using...
May, 11 2020
Sharing Link
Click the icon to share