What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

A web page hero image is the prominent visual near the top of a page, usually spanning the available width and appearing beside or behind the headline. Its job is to establish context and tone while supporting the page’s main action—not to carry essential text or detailed data. Build it around the content, design a focal point that survives responsive cropping, provide accessible alternatives, and deliver only the dimensions each device needs.

What a hero image is—and what it is not

The U.S. National Science Foundation describes a hero component as a large image at the top of a page that fills the window width and sets the tone. In practice, a hero may be a full-bleed photograph, illustration, product scene, or editorial image paired with a heading and call to action. It is usually “wallpaper” rather than a detail image, so charts, maps, diagrams, screenshots containing tiny labels, and other information-dense graphics belong in the page content instead.

Keep the meaningful headline, supporting copy, and button in HTML. Text baked into a bitmap can be cropped, become unreadable on small screens, or fail to resize for users who zoom. NSF presents this as guidance for its component system, not a universal law; apply the same reasoning to your own layout.

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

Choose the visual before choosing its dimensions

Match the page’s purpose

  • Product or service page: show the product in a recognizable context, leaving quiet space where the HTML heading will sit.
  • Editorial article: choose an image that adds subject context without pretending to summarize every fact in the story.
  • Campaign or landing page: make the intended action obvious and check that the image does not compete with the call to action.

Plan for cropping

Identify the subject’s focal point and keep it away from edges likely to disappear. A wide desktop crop can become a short mobile crop, while an image used with object-fit: cover may lose the sides. Test the actual component at narrow, medium, and wide widths, including landscape and portrait orientations. If the composition cannot survive those crops, create art-directed variants rather than forcing one file everywhere.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Use dimensions as a starting point, not a rule

NSF’s author guidance gives 1920 × 1080 pixels (16:9) as its preferred full-size example for high quality on large monitors, and 1366 × 768 as a smaller example with the same ratio. Those are source-specific recommendations, not universal requirements. The correct intrinsic dimensions depend on the largest rendered slot, device-pixel ratio, crop, and compression format. Sending a 4K original to a 900-pixel slot wastes bytes; sending a small file to a large, high-density display looks soft.

Decision Practical approach
Large desktop slot Prepare a source at or somewhat above the slot’s rendered CSS width; 1920 × 1080 is NSF’s preferred 16:9 example, not a requirement.
Smaller or mobile slot Provide narrower candidates so the browser can avoid downloading the desktop file.
Art direction Use <picture> when mobile needs a different crop or composition.
Quality Compress and compare visual quality at the actual display size; there is no single safe file-size number for every image.

Write useful alternative text and accessible overlays

W3C WAI recommends a null text alternative, alt="", when an image is purely decorative. For an informative hero, describe the meaningful subject and its relationship to the page in a concise phrase. Google likewise recommends contextual alt text rather than keyword stuffing. Do not repeat the visible heading word for word unless the image itself conveys that information.

  • Informative: alt="Engineer reviewing a dashboard on a laptop".
  • Decorative: alt="" when the adjacent HTML already provides the message and the visual adds atmosphere only.
  • Functional: if the image is the only link or button label, describe the destination or action.

Check overlay text against every crop. A dark gradient, solid panel, or alternate art direction may be necessary, but verify contrast on the real image rather than assuming a treatment is sufficient. Keep controls keyboard reachable and ensure text remains present when images fail to load.

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

Implement responsive, stable HTML

Google recommends a standard <img> element because its crawler can discover the URL in src; CSS background images are not indexed in the same way. Use srcset or <picture> with a fallback src. Explicit width and height let the browser reserve space and reduce layout shifts.

<img
  src="hero-1200.webp"
  srcset="hero-480.webp 480w, hero-800.webp 800w, hero-1200.webp 1200w"
  sizes="(max-width: 600px) 100vw, 80vw"
  width="1200"
  height="675"
  alt="Describe the meaningful image content"
  fetchpriority="high"
>

The example is illustrative. Replace the alt text, dimensions, and candidates with values from your layout. If the visual is decorative, use alt="". If mobile requires a different composition, art-direct it:

<picture>
  <source media="(max-width: 600px)" srcset="hero-mobile.webp">
  <img src="hero-desktop.webp" width="1920" height="1080"
       alt="A cyclist riding through a mountain pass">
</picture>

Set CSS that preserves the reserved ratio and your intended crop:

.hero img {
  display: block;
  width: 100%;
  height: auto;
}

.hero--cover img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% 50%;
}

Use a fixed aspect ratio only when it reflects the component. If the design has variable height, keep the intrinsic dimensions accurate and let the image’s natural ratio determine layout.

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

Loading strategy and Core Web Vitals

If the hero is the above-the-fold Largest Contentful Paint (LCP) element, do not lazy-load it. Chrome’s guidance recommends prioritizing the actual LCP resource where appropriate, not marking every image as high priority. Confirm which element is LCP on the real page before adding fetchpriority="high"; a hero below the fold should not receive that hint. Reserve loading="lazy" for off-screen images.

Optimize the file without damaging the focal subject. Choose a modern format supported by your delivery stack, retain a fallback where needed, and measure the transferred bytes at the target viewport. A content-delivery or image-transformation service can generate the widths in your srcset. Avoid shipping one oversized original to every visitor.

Search and social previews

Google says image preview selection is automated. You can indicate a preferred image with schema.org primaryImageOfPage or an og:image meta tag, but neither guarantees which image will appear. Select an image relevant to the page, avoid a generic logo or text-heavy artwork, and avoid extreme aspect ratios.

<meta property="og:image" content="https://example.com/images/article-hero.jpg">

The Open Graph protocol makes a page a rich object in a social graph and includes image metadata; it does not define one universal hero-image size. Check the current requirements of each destination platform when a particular social crop matters.

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

A repeatable hero-image workflow

  1. Define the message. Write the page’s headline and action first, then select imagery that supports them.
  2. Mark the focal point. Note the subject and safe text area; create a mobile crop if the subject would be lost.
  3. Prepare source files. Export only the needed aspect ratios and widths. Treat 1920 × 1080 as NSF’s preferred full-size example, not a mandatory target.
  4. Write the alternative text. Decide whether the image is informative, decorative, or functional and set alt accordingly.
  5. Implement responsive markup. Use srcset/sizes or <picture>, a fallback src, and accurate dimensions.
  6. Set loading priority. Keep an above-the-fold LCP image eager and consider high priority only for that actual resource; lazy-load images below the fold.
  7. Test failures. Disable images, zoom text, navigate by keyboard, and inspect narrow and wide viewports.
  8. Inspect real metrics. Confirm the selected resource, rendered dimensions, layout stability, and transferred bytes in browser performance tools.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

The subject is cut off on phones

The desktop crop is being reused in a narrower slot. Add a mobile <source>, adjust object-position, or redesign the composition with more safe space.

Text is unreadable over the image

Move the heading into HTML if it was embedded in the bitmap. Add a controlled overlay, choose a quieter image area, and test contrast at every breakpoint.

The page jumps while loading

Provide accurate width and height (or an equivalent aspect-ratio box) before the image arrives. Verify that CSS does not later replace those dimensions with an incompatible ratio.

The hero loads slowly

Check whether a large desktop file is being selected on mobile, whether the image is accidentally lazy-loaded, and whether compression or caching is working. Use srcset/sizes and prioritize only the actual above-the-fold LCP image.

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

Google or a social network shows the wrong image

Preview selection is automated. Add a relevant og:image and, where appropriate, primaryImageOfPage, then confirm that the URL is crawlable and not blocked. These signals improve eligibility but cannot force a particular preview.

The image conveys information but has empty alt text

Replace alt="" with a concise description of the visual’s purpose. Conversely, keep empty alt text when the hero is genuinely decorative and the adjacent text already carries the message.

Or skip the browser setup

When you need a current screenshot of a page—not just a designed hero asset—ScreenshotNeo can capture it with one request. It accepts cookie and consent banners as a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

See the ScreenshotNeo API documentation for parameters. A basic call is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Every plan includes the full feature set, including full-page and element capture, device presets, custom viewports, retina scale, PDF output, custom CSS and JavaScript, waits, request blocking, headers, cookies, geolocation, caching, signed links, asynchronous webhooks, bulk capture, usage data, and an OpenAPI specification. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

Frequently Asked Questions

Should every hero image use a 16:9 ratio?

No. 16:9 is the U.S. National Science Foundation’s preferred full-size example. Choose the ratio that fits your component and test its crops across viewports.

Can a hero be a CSS background image?

It can be a visual design choice, but a standard HTML image is preferable when the image is meaningful because Google can discover its URL in src and assistive technology can receive an appropriate alternative.

When should a hero have empty alt text?

Use alt="" only when the image is decorative and nearby HTML already communicates the page’s message.

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

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$15.74
SaleBestseller No. 2
SaleBestseller No. 4

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.