amp-img AMP HTML


For the image, not required special JavaScript, is enough with JS AMPHTML in General. There is a difference in the way of writing the image than usual. The code for the image:

  <amp-img src="url-image-here"
width="1080"
height="610"
layout="responsive"
alt="AMP HTML"></amp-img>

Layouts that support: fill, fixed, fixed-height, flex-item, nodisplay, responsive
Use srcset to determine the appropriate size of the screen image. Code like this

  <amp-img src="https://ampbyexample.com/img/amp.jpg"
srcset="https://ampbyexample.com/img/amp.jpg 1080w, https://ampbyexample.com/img/amp-900.jpg 900w, https://ampbyexample.com/img/amp-800.jpg 800w,
https://ampbyexample.com/img/amp-700.jpg 700w, https://ampbyexample.com/img/amp-600.jpg 600w, https://ampbyexample.com/img/amp-500.jpg 500w, https://ampbyexample.com/img/amp-400.jpg 400w,
https://ampbyexample.com/img/amp-300.jpg 300w, https://ampbyexample.com/img/amp-200.jpg 200w, https://ampbyexample.com/img/amp-100.jpg 100w"
width="1080"
height="610"
layout="responsive"
alt="AMP HTML"></amp-img>

To see the effect, please resize the browser.


You Might Also Like:

Disqus Comments

Hello, how may we help you? Just send us a message now to get assistance.

Facebook Messenger ×