Course contentsShow
← Web Development
Lesson 2021 of 2,98237. Image and Asset OptimizationFree lesson

Eager Loading Above the Fold

Understand when to skip lazy loading for critical above-the-fold images using loading='eager' or priority hints.

Eager Loading Above the Fold

You'll learn when and why to override lazy loading for the most visible images on your page.

Now that you've learned about native lazy loading with loading="lazy" (lesson 2017), it's time to understand the exception to the rule: above-the-fold images should load eagerly, not lazily.

The Problem with Lazy Loading Everything

The "fold" is the visible portion of your page when it first loads—before any scrolling. Images here are critical to the initial user experience. If you mark them as loading="lazy", the browser may delay fetching them until it's certain they're needed, which can slow down how quickly users see meaningful content.

Think of it like a restaurant: you want the menu visible immediately when guests sit down, not after they've asked for it. The menu is "above the fold."

Using loading="eager"

To ensure critical images load immediately, explicitly set:

<img src="hero-banner.jpg" loading="eager" alt="Welcome banner">

The loading="eager" attribute tells the browser: "This image is important—fetch it right away with high priority."

When to Use Eager Loading

  • Hero images at the top of the page
  • Logo in the header
  • First product image in a listing
  • Any image visible without scrolling on most devices

This balances performance: lazy load below-the-fold images to save bandwidth, but eager load critical visuals to pass Core Web Vitals metrics like LCP (Largest Contentful Paint).

Key Takeaway:
Use loading="eager" on above-the-fold images to prioritize critical content and avoid delaying what users see first—reserve loading="lazy" for everything else.