Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Hero background image in CSS loads late: how to fix LCP

PRF-010Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Browsers scan the HTML early to find images, scripts and styles to download. This is called the preload scanner. It finds <img> tags in the HTML straight away. It does not see images that are only referenced inside CSS, such as background-image: url(hero.jpg).

For a CSS background, the browser must first download the stylesheet, parse it, work out which element uses the rule, and only then request the image. On a slow phone connection that extra wait can add a second or more before the hero even begins to download.

Largest Contentful Paint (LCP) is the time until the biggest visible element on screen is drawn. On many landing pages that element is the hero image, so a late-discovered background directly raises your LCP.

Typical pattern that causes late discoverycss
.hero {
  background-image: url('/images/hero.jpg');
  background-size: cover;
  min-height: 600px;
}
Why a CSS background image starts late
  1. HTML arrivesBrowser starts reading the page
  2. CSS downloadedStylesheet fetched and parsed
  3. Hero image foundOnly now does the browser see the url()
  4. Image downloadsStarts late, competes with other files
  5. LCP paintedVisitor sees the hero much later

The image request waits behind the HTML, the stylesheet and the style calculation.

Why it costs you leads or sales

Visitors from ads or search judge a page in the first moments. If the main visual and headline area stay empty or jump in late, some leave before they see your offer. Slow LCP on a paid landing page also means you pay for clicks that never get a real look at the page.

The effect is usually worst on mobile, where connections are slower and the stylesheet is often large. Page builders and themes that set hero sections as backgrounds by default make this very common.

Where the time goes on a slow phoneExample numbers
Where the time goes on a slow phone (example)CSS background (before): 3.8 seconds; img tag + high priority (after): 2.1 seconds0133.82.1CSS background (befor…img tag + high priori…seconds

Example: illustrative LCP times for the same hero image, before and after moving it out of CSS. Your numbers will differ.

How to check if your site has it

Check whether your LCP element is a CSS background
  1. Run PageSpeed Insights

    Test your landing page URL at pagespeed.web.dev on the mobile tab. Open the LCP breakdown in the diagnostics.

  2. Read the LCP element

    Under 'Largest Contentful Paint element', check whether it is an <img> or a <div>/<section> with a background image. A block element with a background points to this issue.

  3. Look at the LCP phases

    In Chrome DevTools, open the Performance panel and record a page load. A large 'resource load delay' (time before the image request starts) is the signature of late discovery.

  4. Check the Network panel

    Reload with the Network tab open and throttling set to Fast 4G. If the hero image request starts after the CSS file finishes, the browser found it through the stylesheet.

  5. Search the source

    View page source and search for the hero file name. If it appears only in CSS or in an inline style="background-image" and not in an <img> tag or a preload link, it is discovered late.

How to fix it

The best fix is to make the hero a real <img> element. If your theme or builder makes that hard, preload the background image so the browser fetches it at the start.

Option 1: replace the background with an img taghtml
<section class="hero">
  <img
    src="/images/hero-1200.webp"
    srcset="/images/hero-600.webp 600w, /images/hero-1200.webp 1200w, /images/hero-1800.webp 1800w"
    sizes="100vw"
    width="1200" height="600"
    alt="Describe the hero image"
    fetchpriority="high"
    class="hero-img">
  <div class="hero-content">...</div>
</section>
Make the img behave like a backgroundcss
.hero { position: relative; min-height: 600px; }
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}
.hero-content { position: relative; }
Option 2: keep the CSS background and preload the imagehtml
<link rel="preload" as="image" href="/images/hero-1200.webp" fetchpriority="high">
Option 2b: preload a responsive backgroundhtml
<link rel="preload" as="image"
  href="/images/hero-1200.webp"
  imagesrcset="/images/hero-600.webp 600w, /images/hero-1200.webp 1200w, /images/hero-1800.webp 1800w"
  imagesizes="100vw"
  fetchpriority="high">
Fix by platform
  1. Use an image element in your builder

    In Elementor, Divi or Gutenberg, replace the section's background image with an Image or Cover block where the theme allows it. The Gutenberg Cover block can output a real <img> when you use its image (not a CSS background) and 'Fixed background' is off.

  2. Or add a preload in the head

    Add the preload link through your theme's header.php, a child theme, or a header-injection plugin. Load it only on the landing pages that need it.

  3. Check caching and optimisation plugins

    If a plugin rewrites or lazy-loads backgrounds, exclude the hero from that setting and clear the cache.

Hero image discovery

Before

  • Hero set with background-image in CSS
  • Image request starts after the stylesheet is parsed
  • LCP element is a div or section
  • Large 'resource load delay' in DevTools

After

  • Hero is an img tag or is preloaded
  • Image request starts with the HTML
  • LCP element is the img
  • Resource load delay close to zero

How to confirm it's fixed

Confirm the fix
  • View source: the hero file appears in an <img> tag or a preload link in <head>
  • DevTools Network tab: the hero request starts at the same time as the CSS, not after it
  • PageSpeed Insights shows the LCP element as the img, or shows the preload being used
  • The 'resource load delay' phase is much smaller than before
  • No second download of the same image under a different URL
  • The hero still looks right on mobile and desktop widths

How to prevent it happening again

Prevention habits
  • Add 'hero is a real img with fetchpriority high' to your landing page template checklist
  • Avoid page builder presets that set the first section's image as a background
  • Re-run PageSpeed Insights on mobile after every theme, builder or plugin update
  • When swapping the hero file, update any preload link to the new URL
  • Keep a record of your normal LCP time so a rise stands out

How FunnelGuard handles this

FunnelGuard detects this issue only partly. Its scheduled checks measure the LCP time on your funnel steps, so you are alerted when a page gets slow. What it does not do is identify the cause: it cannot tell you that the slowness comes from a hero background set in CSS and discovered late.

Questions people ask

Why is my hero background image slow to load?

If the hero is set with CSS background-image, the browser only discovers it after downloading and parsing the stylesheet. The image request starts late, which delays Largest Contentful Paint. Using an <img> tag or a preload link lets it start immediately.

Does a CSS background image hurt LCP?

Yes, it can. Background images in CSS are not found by the browser's early HTML scan, so they start downloading later than an <img> tag would. If the background is your largest visible element, your LCP rises.

How do I preload a CSS background image?

Add <link rel="preload" as="image" href="/path/hero.webp" fetchpriority="high"> early in the <head>. The href must match the exact file the CSS requests. For responsive images, add imagesrcset and imagesizes attributes.

Should I use an img tag or a CSS background for a hero image?

Use an <img> tag when the hero is meaningful content and is above the fold, because the browser finds it early and you can set fetchpriority="high". Use CSS backgrounds for decorative images lower on the page.

How can I tell if my LCP element is a background image?

Run PageSpeed Insights and look at the 'Largest Contentful Paint element' in the diagnostics. If it shows a div or section rather than an img, a background image is likely. Chrome DevTools' Performance panel shows the same detail.

Can Elementor or Divi hero backgrounds cause slow LCP?

Yes. Page builders often set section images as CSS backgrounds, so they are found late. Replace the background with an image element where the builder allows it, or add a preload link for the hero file.

Does FunnelGuard tell me my hero is a CSS background?

No. FunnelGuard detects the LCP time on your funnel steps but not the cause. Use PageSpeed Insights or DevTools to see whether the LCP element is a CSS background, then apply the fix.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: LCP time detected, cause not.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.