mafortis
mafortis

Reputation: 7138

Fix AMP stylesheet error

I'm getting error in AMP Validator for my stylesheet's

The attribute 'href' in tag 'link rel=stylesheet for fonts' is set to the invalid value 'http://domain.cooooom/css/style.css'. Learn more.

I have searched about it and reached to this article from official AMP website.

screen 1

This is the most ridiculous suggestion I've ever seen during all these years of my work.

They suggest I move all my external CSS files codes to my app head part directly and put them in <style amp-custom> tag! so i will have a long & messy head tag just because they can't follow HTML5 standards.

Question

Is there anyway I avoid doing this messy job and validate my file?

Upvotes: 0

Views: 1013

Answers (1)

Lovntola
Lovntola

Reputation: 1409

Yes this is how AMP works. You must insert your CSS inline in HTML to save an additional Network. @import is also forbidden.

And the best way is to create a AMP own css Style not put in all your css style from the non-AMP Site.
TIPP: you can insert up to 50KByte CSS but a good work is to keep under 14K ;-)

Upvotes: 1

Related Questions