Skip to main content

Lesson 8 of 8

Performance Optimization & Core Web Vitals

Page speed directly affects search rankings and user experience. Google's Core Web Vitals measure three key metrics: LCP (loading speed), CLS (visual stability), and INP (interactivity). Many HTML-level optimizations - lazy loading, resource preloading, script deferring, and image optimization - can dramatically improve performance.

15 minBy Priygop Editorial TeamUpdated 2026Peer Reviewed & Verified

Performance Optimization

  • LCP (Largest Contentful Paint < 2.5s) - Optimize hero image: fetchpriority='high', appropriate size, WebP format.
  • CLS (Cumulative Layout Shift < 0.1) - Always set width/height on images and iframes. Use aspect-ratio CSS.
  • INP (Interaction to Next Paint < 200ms) - Defer non-critical JavaScript. Break long tasks into smaller chunks.
  • <link rel='preload'> - Preload critical resources (fonts, hero image). Browser downloads them immediately.
  • <link rel='preconnect'> - Establish early connections to third-party domains (CDN, API, fonts).
  • async vs defer on scripts - async: download + execute immediately (analytics). defer: download + execute after DOM parsed (app logic).
  • Inline critical CSS - Put above-fold CSS in <style> tag. Load full CSS asynchronously for faster first paint.
  • Lazy load below-fold content - loading='lazy' on images and iframes below the viewport.
  • Test with Lighthouse - DevTools > Lighthouse > Performance. Aim for 90+ score.

Tip

Use the loading='lazy' attribute on all images below the fold, but never on your hero image or above-the-fold content. For the hero image, use fetchpriority='high' instead to tell the browser to download it first. This simple change can improve LCP by 20-40%.

Diagram
Loading diagram…

Core Web Vitals are Google ranking factors - optimize for all three

Module 10 - Knowledge Check

Module 10 - Knowledge Check
Question 1 of 5

What is the ideal maximum length for a <title> tag in characters?

Key Takeaways

  • Page speed directly affects search rankings and user experience.
  • LCP (Largest Contentful Paint < 2.5s) - Optimize hero image: fetchpriority='high', appropriate size, WebP format.
  • CLS (Cumulative Layout Shift < 0.1) - Always set width/height on images and iframes. Use aspect-ratio CSS.
  • INP (Interaction to Next Paint < 200ms) - Defer non-critical JavaScript. Break long tasks into smaller chunks.

Hands-on Practice Tools for this Course

Test what you learn using these free in-browser developer utilities (no signup required).

All 40+ Tools

Topics in This Module

0/8 done