How to brings fonts in your html document (lt.14)

·

2 min read

Generally, we bring fonts in our html documents using google fonts.

In this lecture, i will show you step-by-step bringing of fonts.

  1. Open Google Fonts:https://fonts.google.com/

  2. Now select the font which you want to use , inside it you will see the different subclass of that font select any of them you will see a select option.

  3. On the right-hand side of the screen, you will see a link to that font copy it and paste it below meta tag of the html document.

  4. alternate for step 2 and 3(Look for an embed code option there , click it and copy the html code ).

  5. Now link the css style sheet in html document , also in the font page you will see a css link, copy it and paste it in your css file .

A code to demonstrate the above steps.

html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- google fonts link -->
    <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=Work+Sans:wght@200&display=swap"
      rel="stylesheet"
    />

    <title>fonts</title>

<--css style sheet link-->

    <link rel="stylesheet" href="fonts.css" />
  </head>
  <body>
    <h1> bring fonts</h1>
    <h3>
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Officia id
      tempore sit perspiciatis cumque, maxime eos laborum atque quos fugit?
    </h3>
  </body>
</html>

css file:

body{
    background-color: aquamarine;
    font-family: 'Work Sans', sans-serif;  // css file of the font we used
}

lt.13 link: https://hashnode.com/post/clod6conh000409l7fc2s9492

Did you find this article valuable?

Support himanshu by becoming a sponsor. Any amount is appreciated!