Home » » Kode penulisan Image AMP HTML

Kode penulisan Image AMP HTML

Untuk memasukkan image di amp html, tidak diperlukan JavaScript khusus, sudah cukup dengan JS AMPHTML secara umum. Ada perbedaan cara penulisan image dari biasanya. Kode untuk image:

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

Layout yang support: fillfixedfixed-heightflex-itemnodisplayresponsive
Gunakan srcset untuk menentukan gambar sesuai ukuran layar. Kodenya seperti ini

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

0 comments:

Post a Comment

Test Feed Box

Adblock Detected

Like this blog? Keep us running by whitelisting this blog in your ad blocker

This is how to whitelisting this blog in your ad blocker

Thank you

×