Audit template image tags for layout shifts

Review image tags in template code for missing width, height, and incorrect lazy-loading rules. Use it to fix Cumulative Layout Shift and LCP issues.

You getIssue Diagnosis, corrected Code and implementation Notes

Prompt

Prompt
Act as a web performance and Core Web Vitals specialist. Audit the pasted HTML template image code for layout shifts and loading bottlenecks.

- Check for missing explicit width and height attributes or CSS aspect-ratio properties causing Cumulative Layout Shift (CLS).
- Ensure Largest Contentful Paint (LCP) and above-the-fold hero images do NOT have loading="lazy" enabled.
- Verify appropriate use of decoding="async" and fetchpriority="high" on priority visual elements.
- Recommend modern responsive image markup with srcset and proper sizes attributes.

Output format:
1. Issue Diagnosis: table with Line/Image, Identified Defect, Impact on Core Web Vitals.
2. Corrected Code: code block showing the corrected, production-ready image markup.
3. Implementation Notes: bullet list of rules for developers building reusable templates.

Here is the template image code:

Example output

Example for: an e-commerce product hero template snippet

  1. Issue Diagnosis:
Line/ImageIdentified DefectImpact on Core Web Vitals
img.hero-bannerloading="lazy" on hero bannerHigh LCP penalty; delays hero image download
img.hero-bannerMissing width and height attributesHigh CLS; forces page reflow when rendered
img.thumbdecoding="sync"Minor render-blocking thread contention
  1. Corrected Code:
<!-- Hero Image: Above the fold -->
<picture>
  <source srcset="/img/hero-800.webp 800w, /img/hero-1600.webp 1600w" sizes="(max-width: 768px) 100vw, 1200px" type="image/webp">
  <img src="/img/hero-1600.jpg"
       width="1600"
       height="900"
       alt="Featured product launch"
       fetchpriority="high"
       decoding="async">
</picture>

<!-- Below the fold thumbnail -->
<img src="/img/thumb-400.jpg"
     width="400"
     height="400"
     alt="Related product"
     loading="lazy"
     decoding="async">
  1. Implementation Notes:
  • Reserve space with CSS aspect-ratio: 16 / 9 on image wrappers if images scale responsively.
  • Never apply loading="lazy" to the first image visible inside the mobile viewport.
Written by AI from this prompt. Your results will vary.

Paste your page header, hero image snippet, or article card template directly after the prompt in ChatGPT, Claude, or Gemini. Follow up by specifying your CSS framework or image CDN to get exact component code.

Make it repeatable

Keep using this prompt without pasting it in every time.

Keep exploring

More in SEO