AMP validation error “The mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'…”

本小妞迷上赌 提交于 2019-12-11 18:12:38

问题


A web page has the following AMP validation error:

The mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'. (see https://www.ampproject.org/docs/guides/author-develop/responsive/style_pages)

I searched the page source, and could not find "amp-custom". In other words, the page does not have tag 'style amp-custom'.

Could anyone offer a hint on a possible cause of this error?


回答1:


I'm on my phone so bear with me here... amp-custom is where you include your custom CSS. It goes before the amp-boilerplate in the head so as to not overwrite anything the boilerplate is doing. Check out the page about adding custom CSS on the AMP project page: https://www.ampproject.org/docs/design/responsive/style_pages

All CSS must be inline, you cannot use a link tag to include your CSS. You can either hardcode the CSS inline or you can include it via PHP or the method shown on the page linked above. There is a file size limit to the amount of CSS allowed as well.



来源:https://stackoverflow.com/questions/51758230/amp-validation-error-the-mandatory-attribute-amp-custom-is-missing-in-tag-st

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