Skip to content Skip to sidebar Skip to footer

How To Add Custom CSS And Script In AMP Pages

Sample document @import statement in the page head which wouldn't be valid even if this wasn't AMP. I'd suggest compiling it first and then copying the contents into the style tags. Keep in mind there's 50,000 byte size limit too.

For example:

<style amp-custom>
  h1 {
   color: red
  }
</style>

As for the script, you're not able to include authored JavaScript in AMP documents. You'll need to look for an equivalent AMP component.


Solution 2:

it's working for me, try this

<style amp-custom>
        @import url('css/main.css');
</style>

Post a Comment for "How To Add Custom CSS And Script In AMP Pages"