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

There is no universal pixel size for a website banner. The right design is the one that preserves its focal subject, hierarchy, readable action text, and loading performance across the containers your site actually uses. Start with the banner’s job, create a crop-safe composition, keep important copy in HTML, and test at desktop, tablet, mobile, 320 CSS pixels, and zoomed views.

Start with the banner’s job

A banner is a prominent visual region used for branding, a campaign message, navigation context, or a call to action. Its purpose determines the composition, text, alt text, and loading priority.

  • Brand banner: establish identity without making a logo or slogan unreadable at narrow widths.
  • Campaign banner: communicate one offer or message, with a clear action and a focal subject that survives cropping.
  • Navigation-context banner: orient visitors to a section or product category; clarity matters more than visual drama.
  • Conversion banner: give the action visual priority and keep the button or link available when text enlarges.

Write the success condition before opening a design tool. For example: “A visitor can identify the product and activate the primary action without zooming or guessing.” That statement is more useful than choosing a fashionable aspect ratio.

Choose dimensions from the container, not a universal preset

Measure the rendered slot in your layout. A full-width hero, a card banner, and a sidebar promotion have different aspect ratios and therefore need different source images. Keep the source large enough for the widest intended rendering, but do not send a desktop-sized asset to a small mobile slot when responsive selection can avoid it.

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.
Decision What to define Why it matters
Container Maximum content width and the widths at which the layout changes Determines the visible crop and the resource the browser should request
Aspect ratio Width-to-height relationship for each layout state Controls how much of the subject remains visible
Focal point Subject location and the safe area around it Prevents faces, products, logos, or essential words being cut off
Text zone Area with predictable contrast after cropping Leaves room for an HTML heading, supporting copy, and action
Intrinsic dimensions width and height, or an explicit aspect ratio Lets the browser reserve space and reduces layout shifts

Design the wide composition first, then inspect a narrow crop. Keep the subject and essential visual information inside a center-safe area unless your art direction deliberately places the subject elsewhere. If the subject cannot survive the narrow crop, do not keep shrinking the desktop image: provide a separate mobile composition.

Build a responsive banner with HTML and CSS

Use a normal <img> when the same image can be cropped acceptably at every width. Include srcset, sizes, a fallback src, and intrinsic dimensions. The browser can then choose a suitable file for viewport width and pixel density.

<img
  src="/images/launch-1280.webp"
  srcset="/images/launch-640.webp 640w,
          /images/launch-1280.webp 1280w,
          /images/launch-1920.webp 1920w"
  sizes="(max-width: 700px) 100vw, 1200px"
  width="1920"
  height="700"
  alt="The Nova laptop on a desk beside a cup of coffee"
>

The sizes value should describe the image’s actual rendered width, not the viewport in every case. If the banner occupies half the page on larger screens, express that relationship instead of claiming it is always 100vw.

Use <picture> for art direction (a genuinely different crop) or format negotiation. Put the mobile composition first, then provide wider sources and a fallback image:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#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
<picture>
  <source media="(max-width: 700px)"
          srcset="/images/launch-mobile.avif"
          type="image/avif"
  >
  <source srcset="/images/launch-desktop.avif" type="image/avif"
  >
  <source srcset="/images/launch-desktop.webp" type="image/webp"
  >
  <img src="/images/launch-desktop.jpg"
       width="1920" height="700"
       alt="The Nova laptop on a desk beside a cup of coffee"
  >
</picture>

Keep important copy as real HTML so it can reflow, be translated, indexed, selected, and read by assistive technology. A background image can support decoration, but it should not be the only place where a heading or offer exists.

.banner {
  position: relative;
  aspect-ratio: 1920 / 700;
  min-height: 18rem;
  overflow: hidden;
}

.banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
}

.banner__content {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  align-content: center;
  max-width: 34rem;
  padding: clamp(1rem, 4vw, 4rem);
}

@media (max-width: 700px) {
  .banner { aspect-ratio: 4 / 5; }
  .banner__content { max-width: none; align-content: end; }
}

Test the real page, not just a design-board crop. Check desktop, tablet, and a narrow phone; then zoom text and confirm the action remains visible without horizontal scrolling.

Keep banner text readable

Use a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Evaluate the brightest part of the image behind the letters and the worst crop, not only the desktop screenshot you first approved.

  • Place text over a naturally quiet part of the image.
  • Add a translucent scrim or gradient when the background changes in brightness.
  • Use a solid text panel when a gradient cannot guarantee contrast.
  • Change the crop or supply an alternate mobile source if the subject competes with the copy.
  • Keep the heading, supporting sentence, and action short enough to reflow at 320 CSS pixels.

Do not bake essential wording into the bitmap. Images of text are restricted in WCAG 2.2 except where the presentation is decorative or essential; HTML text is the safer default. A button or link should remain a real, keyboard-focusable control rather than a painted element.

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

Write useful alt text

First decide whether the image communicates information. A meaningful banner gets concise, purpose-focused alt text that describes what a visitor needs to understand. A purely decorative image gets an empty attribute, alt="", so a screen reader can skip it.

  • Informative: alt="Two engineers reviewing the Nova dashboard on a large monitor"
  • Decorative: alt="" when the adjacent HTML heading already provides the message and the image adds no information

Do not begin with “image of” or repeat a nearby heading. If the banner contains a product, place the product and its relevant state in the description; do not copy every visual detail.

Optimize file size without blur

Images commonly dominate page transfer: MDN reports that imagery accounts for 51% of bandwidth on the average website, followed by video at 25%. Optimize the asset that is actually rendered rather than exporting one enormous file for every device.

  • Serve AVIF or WebP where supported, with a JPEG or PNG fallback.
  • Generate several widths and let srcset and sizes select among them.
  • Keep source dimensions close to the rendered slot; extra pixels add bytes without adding visible detail.
  • Reserve space with intrinsic dimensions or CSS aspect-ratio.
  • Lazy-load banners below the fold. Do not lazy-load a visible hero: Chrome guidance warns that doing so can harm Largest Contentful Paint.
  • Compress photographic images carefully and inspect fine text, hair, and product edges at 100% zoom before publishing.

A visible hero is usually a loading priority. A promotional banner several screens below the first viewport is a candidate for loading="lazy". Confirm the choice with a performance trace on the slowest connection your audience actually uses.

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.

Make the banner discoverable

Use an HTML <img> or <picture> element. Search crawlers can find an image in an element’s src, including an img child inside picture; CSS background images are not indexed in the same way. Supply a fallback src, descriptive alt text, and meaningful surrounding page context.

Keep an important reused image at a consistent URL. If valuable images are otherwise difficult for crawlers to discover, an image sitemap can provide another discovery path. Alt text is metadata for both accessibility and image understanding, so write it for the visitor first rather than stuffing keywords.

A practical review workflow

  1. Define the job: write the one message and one primary action the banner must support.
  2. Mark the safe area: keep the focal subject and any essential visual detail away from edges likely to be cropped.
  3. Compose the widest state: establish hierarchy, then check the narrow crop immediately.
  4. Choose the implementation: use img with responsive sources for a shared crop; use picture for art direction or format negotiation.
  5. Overlay HTML: add the heading and action as real text and controls.
  6. Verify contrast: test normal and large text against the brightest background area.
  7. Verify reflow: test a 320 CSS-pixel-wide presentation and zoom. There should be no loss of information, functionality, or required two-dimensional scrolling.
  8. Inspect loading: check intrinsic space, requested resource width, hero priority, and below-fold lazy loading.
  9. Check accessibility: confirm keyboard focus, concise alt text (or empty alt for decoration), and a usable action name.

Troubleshooting common banner failures

The subject disappears on phones

Cause: a centered desktop crop cannot preserve an off-center subject. Fix: move the focal point into the safe area, adjust object-position, or provide a mobile source with picture.

The heading is unreadable over the photo

Cause: the image has no stable contrast zone. Fix: add a scrim, gradient, or solid panel; retest the brightest crop and meet the 4.5:1 or 3:1 requirement.

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

The page jumps while the banner loads

Cause: no intrinsic dimensions or reserved aspect ratio. Fix: add width and height to the image or set the container’s aspect-ratio.

The banner is blurry on high-density screens

Cause: the largest candidate is too small for the rendered slot and device pixel density. Fix: add an appropriately larger source width, while retaining smaller candidates for smaller slots.

Mobile users download a huge desktop file

Cause: missing or inaccurate srcset/sizes, or an art-directed crop forced into one file. Fix: describe the actual slot in sizes and use picture when the composition must change.

The call to action vanishes when text is enlarged

Cause: fixed-height positioning or text embedded in the image. Fix: use HTML text, allow the content area to grow, and test zoom and 320 CSS pixels before release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need screenshots of the finished banner for QA, documentation, or an approval workflow, ScreenshotNeo is a website screenshot API and MCP server. It accepts cookie and consent banners before capture, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and bills only clean shots. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; each response identifies the page verdict and billing state in headers.

A single request captures a rendered page without installing or driving a local browser:

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}`);

See the ScreenshotNeo documentation for the complete request options. You can select full-page or element captures, dark mode, device presets or custom viewports, retina scale, PDF output, custom CSS and JavaScript, click actions, selector hiding, wait conditions, blocked resources, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, a chosen cache TTL, signed image links, asynchronous webhooks, bulk capture, usage data, and the OpenAPI specification. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—let Claude, Cursor, or another MCP client capture pages through an agent.

Plan Included screenshots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is available on every plan. Start with 1,000 free screenshots a month with no card.

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

Frequently Asked Questions

Should a banner be an image background or an img element?

Use an HTML image element when the visual carries information or should be discoverable. A background can support decoration, but do not hide the only meaningful message there.

What is the safest mobile banner ratio?

There is no safe universal ratio. Select a ratio from the mobile container and focal subject, then use a separate mobile source when the desktop crop fails.

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.75
SaleBestseller No. 2
SaleBestseller No. 4

Should every banner use lazy loading?

No. Lazy-load banners below the fold; keep a visible hero eager because delaying it can hurt Largest Contentful Paint.

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.

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