Search code snippets, questions, articles...

Add fonts to AMP webpage

You can add fonts to AMP web pages directly by adding a link to those fonts which are allowed.
<!-- You can add fonts using link tag or using @font-face -->
<!-- Add fonts using google fonts -->
<!-- Add below within head tag -->
<link href="" rel="stylesheet" type="text/css">
<style amp-custom>
    body {
        font-family: 'Roboto', sans-serif;

By default, you can not link your external stylesheets to your AMP pages but in the case of adding fonts to your website, you can add them directly using the link tag.

In the code snippet, we are adding the 'Roboto' font family from google fonts.

Search Index Data (The code snippet can also be found with below search text)

AMP fonts
Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet