External Style Sheet is not valid in AMP Pages

﹥>﹥吖頭↗ 提交于 2019-11-27 07:14:27

问题


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:

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.

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.


回答1:


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>



回答2:


currently there is no support for external css in Accelerated mobile pages. Although you can use inline css which was not allowed earlier. So you have to compromise with the css.



来源:https://stackoverflow.com/questions/42199925/external-style-sheet-is-not-valid-in-amp-pages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!