Search code examples
amp-html

AMP validation error "The mandatory attribute 'amp-custom' is missing in tag 'style amp-custom'..."


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?


Solution

  • 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.