Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A progressive image loader shows a small placeholder immediately, reserves the final image’s space, then fades in the full image after it has loaded (and, optionally, decoded). The browser should still handle responsive source selection and native lazy loading; a small JavaScript layer is only needed for the visual reveal or decode-before-reveal behavior.

What the loader should do

A robust implementation has four parts:

  1. Reserve the final geometry. Intrinsic width and height, or an equivalent CSS aspect ratio, prevent layout shifts.
  2. Paint a lightweight placeholder. Use a tiny version of the same image, a solid color, or another very small asset.
  3. Request the real image responsively. Let srcset and sizes choose a candidate appropriate for the rendered slot.
  4. Reveal the real image only when ready. A load event is sufficient for most pages; decode() can avoid showing a decoded-after-paint flash on large images.

The placeholder is decorative. The informative alt text belongs on the real <img>, so assistive technology receives one meaningful image rather than two.

These principles align with the guidance on image performance and responsive images.

1. Add the image markup

This framework-neutral example keeps both layers in the same box. Replace the paths and alternative text with your own assets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
<figure class="progressive-image" data-progressive>
  <img
    class="progressive-image__full"
    src="/images/landscape-1200.jpg"
    srcset="/images/landscape-480.jpg 480w,
            /images/landscape-900.jpg 900w,
            /images/landscape-1200.jpg 1200w"
    sizes="(max-width: 600px) 100vw, 80vw"
    width="1200"
    height="800"
    alt="A description of the landscape"
    loading="eager"
    decoding="async">
  <span class="progressive-image__placeholder" aria-hidden="true"
        style="background-image: url('/images/landscape-tiny.jpg')"></span>
</figure>

Keep a valid src fallback even when srcset is present. The browser uses the width descriptors and the sizes expression to select a suitable file; on a narrow screen it can avoid downloading the 1,200-pixel candidate.

Choose the loading mode for the image’s position

Use loading="lazy" for images that start well below the viewport. Do not apply it to the page’s likely largest contentful paint (LCP) image: deferring a visible image can make the main content appear later. For a genuinely critical image, fetchpriority="high" can provide an additional hint, but it is heuristic rather than a guarantee. A lazy image remains deferred even when given high priority. loading="eager" means normal eager queueing, not a priority boost.

See browser-level image lazy loading, Fetch Priority, and the responsive-image guidance for the browser’s loading and prioritization behavior.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

2. Reserve space and layer the two images

.progressive-image {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: #e8e8e8;
}

.progressive-image__full,
.progressive-image__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.progressive-image__full {
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms ease;
}

.progressive-image.is-loaded .progressive-image__full {
  opacity: 1;
}

.progressive-image__placeholder {
  background-size: cover;
  filter: blur(14px);
  transform: scale(1.05);
}

.progressive-image.is-loaded .progressive-image__placeholder {
  opacity: 0;
  transition: opacity 180ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .progressive-image__full,
  .progressive-image__placeholder {
    transition: none;
  }
}

The CSS aspect ratio must match the source image’s ratio. When that ratio is known, the HTML dimensions are preferable because they communicate the intrinsic size to the browser before CSS is fully applied. Use either dimensions, an aspect ratio, or both consistently; do not let the placeholder and final image use different geometry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

object-fit: cover crops both layers in the same way. Choose contain instead when the complete image must remain visible. The blur and slight scale hide the sharp edge that blur filters can otherwise expose; a solid background can be used when you do not want a second image request.

3. Reveal the full image with JavaScript

The following handler works for multiple figures, including images served from cache. It waits for decoding when that API is available and treats a decode rejection as a reason to reveal anyway rather than leaving the placeholder forever.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
for (const figure of document.querySelectorAll("[data-progressive]")) {
  const image = figure.querySelector("img");

  const reveal = () => figure.classList.add("is-loaded");

  const revealAfterDecode = () => {
    if (typeof image.decode === "function") {
      image.decode().then(reveal, reveal);
    } else {
      reveal();
    }
  };

  if (image.complete && image.naturalWidth > 0) {
    revealAfterDecode();
  } else {
    image.addEventListener("load", revealAfterDecode, { once: true });
    image.addEventListener(
      "error",
      () => figure.classList.add("has-error"),
      { once: true }
    );
  }
}

complete covers an image that finished before the script attached its listener. Checking naturalWidth distinguishes a successfully loaded image from a broken request. The error class gives you a hook for a fallback style or message; define that state if a failed image should be visibly different from a still-loading one.

What happens without JavaScript?

The full <img> remains real content, but the CSS above keeps it transparent until a class is added. If users can reach the page with scripts disabled, add a no-script override so the image is visible:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<noscript>
  <style>
    .progressive-image__full { opacity: 1; }
    .progressive-image__placeholder { display: none; }
  </style>
</noscript>

Alternatively, put a small inline rule or server-rendered “loaded” state in your no-JavaScript path. Do not make the placeholder the only meaningful representation of an image.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Placeholder choices and their costs

Approach What the browser downloads When it fits Trade-off
Tiny same-image raster A very small additional image plus the selected full candidate You want a recognizable, blurred preview Adds a request and bytes; keep the tiny asset genuinely small
Solid color No placeholder image request You prefer the lowest overhead or a designed background color Provides no visual preview of the subject
Generated placeholder Depends on your image pipeline You already produce dominant-color or low-quality variants Requires generation and storage or transformation logic

There is no required placeholder encoding. The performance win comes from keeping the placeholder small and delivering an appropriately sized final candidate; a large “preview” can cancel the benefit.

Loading, decoding and priority: choose independently

These attributes solve different problems:

Control Purpose Practical guidance
loading Controls whether offscreen fetching is deferred Lazy-load below-the-fold content; leave the likely LCP image non-lazy
fetchpriority Hints relative network priority Use high sparingly for a truly important image; it is not a guarantee
decoding Expresses a preferred decode strategy async is a reasonable preference for many non-blocking images
decode() Lets script wait for decoding before revealing or inserting an image Useful for large images when a decode-before-reveal transition is worth the extra state handling

Native lazy loading can work without custom JavaScript. The progressive layer is for the visual transition and optional decode coordination, not a replacement for the browser’s image scheduler.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Accessibility and semantics

  • Write useful alt text for an image that conveys information. Use alt="" when it is purely decorative.
  • Keep the placeholder aria-hidden="true"; it should not be announced as a second image.
  • Do not put the descriptive text only in a background image, because CSS backgrounds have no equivalent image alternative for screen readers.
  • Respect prefers-reduced-motion; the example removes the cross-fade rather than forcing animation.

These semantics are part of the responsive-image recommendations at web.dev.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Testing and failure handling

  1. Test with an empty cache and a warm cache. The complete branch must reveal cached images.
  2. Throttle the network and scroll through below-the-fold images. Confirm that lazy images request only when approaching the viewport.
  3. Resize the viewport and inspect the selected srcset candidate. The rendered slot described by sizes should match the actual layout.
  4. Block the full-size request. The has-error state should not leave a permanent loading illusion; provide a fallback style or message appropriate to your design.
  5. Disable JavaScript. The real image must still be available through your no-script rule or server-rendered fallback.
  6. Use a screen reader and keyboard-only navigation to verify that the placeholder is silent and the final image has the intended alternative text.
  7. Check the first viewport separately from article galleries. The likely LCP image should be discoverable early and should not be accidentally deferred.

Reserve space with dimensions or aspect ratio in every state. Progressive presentation improves perceived waiting, but reducing the final transfer size is what gets the fully rendered image to the reader sooner; the image-performance guidance covers that broader optimization.

When to use an image transformation service

If creating 480-, 900- and 1,200-pixel variants manually is burdensome, an image CDN or transformation service can generate and deliver those candidates. Evaluate it against your existing pipeline by comparing variant generation, delivery behavior, integration effort and cache strategy. Keep the HTML contract the same—valid src, accurate srcset/sizes, intrinsic dimensions and accessible alt text—so changing the backend does not change the loader’s semantics.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.