Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
475 views
in Technique[技术] by (71.8m points)

html - External Style Sheet is not valid in AMP Pages

I am converting my HTML page into AMP Pages. I have seen test url https://validator.ampproject.org/#. This page is validate from AMP.

Screen Shot for Help: enter image description here

But When I used External Css.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">

Then It will fail.

Screen Shot For help. enter image description here

Then how can I access materialize css file. Because I am using Materialize Ui framework in my website.

But I have read also about

 <style amp-custom> </style>

SO AMP validate page suggest include inline css in amp-custom. But materialize css is so long. It will break in some mobile browsers. Because https://github.com/ampproject/amphtml/issues/4555

If anybody have some idea then please share.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

External Style Stylesheets are forbidden in AMP. You must include the CSS declaration self (up to 10.000 lines) between. This is for save time by additional network request and blocking rendering.

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...