Adding FontAwesome to style amp-custom

177 Views Asked by At

I am trying to put the source code for FontAwesome:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css">

in section under tag:

<style amp-custom>
...
</style>

in order to be fine with AMP standards and not getting errors in Google validations.

My current code is

<style amp-custom>
@font-face {
font-family: "Font Awesome 6 Free";
src: url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css);}
body { font-family: "Font Awesome 6 Free";content="";}

</style>

However, still I cannot see my FontAwesome icons. Can you help me with correcting the code? Not sure what is wrong for the newest version of FontAwesome.

Thank you for help. Jakub

1

There are 1 best solutions below

4
On

You don't need @font-face in your CSS.

It has to work just by adding FontAwesome CSS file in head:

<head>
<link rel="stylesheet" href="https://use.fontawesome.com">
</head>

And then you can use it in your HTML like this:

<i class="fa fa-bomb" aria-hidden="true"></i>