Placeholders & fallbacks

In the spirit of perceived performance and progressive enhancement, it's best practise in AMP to provide placeholders and fallbacks wherever possible.

Some elements will even reward you for doing it by relaxing restrictions – for example, if you provide a placeholder for amp-iframe, it can be used near the top of the page (which won't work without).


The element marked with the placeholder attribute acts as a placeholder for the parent AMP element. If specified, a placeholder element must be a direct child of the AMP element. An element marked as a placeholder will always fill the parent AMP element.

<amp-anim src="/static/inline-examples/images/wavepool.gif"
  <amp-img placeholder
Open this snippet in playground

By default, the placeholder is immediately shown for the AMP element, even if the AMP element's resources have not been downloaded or initialized. Once ready, the AMP element typically hides its placeholder and shows the content.

NOTE – The placeholder doesn’t have to be an AMP element; any HTML element can act as the placeholder.


You can specify the fallback attribute on an element to indicate the fallback behavior:

  • for any element the browser doesn’t support
  • if the content fails to load (e.g., Tweet deleted)
  • if the image type is unsupported (e.g., WebP isn't supported in all browsers)

You can set the fallback attribute on any HTML element, not just AMP elements. If specified, the fallback element must be a direct child of the AMP element.

Example: Unsupported feature

In the following example, we use the fallback attribute to communicate to the user that the browser doesn’t support a particular feature:

This browser does not support the video element.

<amp-video controls
  <div fallback>
    <p>This browser does not support the video element.</p>
Open this snippet in playground
Example: Serve different image formats

In the following example, we use the fallback attribute to tell the browser to use the JPEG file if the WebP format is unsupported.

<amp-img alt="Mountains"
  <amp-img alt="Mountains"
Open this snippet in playground

Interaction of placeholders and fallbacks

For AMP components that rely on dynamic content (e.g., amp-twitter, amp-list), the interaction of fallbacks and placeholders operates as follows:

  1. Display the placeholder while the content is loading.
  2. If the content loads successfully, hide the placeholder and display the content.
  3. If the content fails to load:
    1. If there's a fallback element, display the fallback.
    2. Otherwise, continue displaying the placeholder.

Hiding loading indicators

Many AMP elements are allowlisted to show a "loading indicator", which is a basic animation that shows that the element has not yet fully loaded. Elements can opt out of this behavior by adding the noloading attribute.