How to use Google’s Roboto font on a website with CSS?

Spread the love

Sometimes, we want to use Google’s Roboto font on a website with CSS.

In this article, we’ll look at how to use Google’s Roboto font on a website with CSS.

How to use Google’s Roboto font on a website with CSS?

To use Google’s Roboto font on a website with CSS, we add the font’s stylesheet into our HTML code.

For instance, we write

<head>
  <link
    href="http://fonts.googleapis.com/css?family=Roboto"
    rel="stylesheet"
    type="text/css"
  />

  <style>
    body {
      font-family: "Roboto", sans-serif;
      font-size: 48px;
    }
  </style>
</head>

to add the stylesheet for the Roboto font with a link tag.

Then we use the font by setting the font-family to Roboto with a style tag.

Conclusion

To use Google’s Roboto font on a website with CSS, we add the font’s stylesheet into our HTML code.

Leave a Reply

Your email address will not be published. Required fields are marked *