DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
aspect ratio

Website Hero Section Sizes: Responsive Dimensions and Layout

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

There is no universal pixel size for a responsive website hero. Build the hero as a flexible layout whose text, controls and media fit the available viewport. Use a minimum height driven by the content, and use an explicit image ratio only when the media needs a stable shape. A fixed “desktop height” and “mobile height” can clip translated copy, enlarged text or a longer call to action.

This approach follows MDN’s responsive-design guidance: responsive design adapts to a range of devices rather than targeting one screen. As MDN puts it, “Responsive web design isn’t a separate technology — it is an approach.”

What size should a website hero section be?

Set the hero’s width to its container and let its height grow from its contents. For a text-led hero, use padding and a readable line length instead of a fixed height. For a split hero, let the text column determine the minimum section height and give the image column a ratio such as 4:3 or 16:9 when a predictable media frame is useful. Those ratios describe the image box, not a universal hero-section standard.

Do not confuse an exported image’s pixel dimensions with its rendered size. CSS scales the image according to the viewport and its container; responsive image sources and pixel density are separate decisions.

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

Why one fixed dimension fails

  • A fixed-width page can create horizontal scrolling on narrow screens and unused space on wide screens, as MDN explains.
  • A fixed height can clip a heading when it wraps, when localization adds words, or when a visitor increases text size or zoom.
  • A very tall hero can push the primary content and call to action below the fold, while a very short one can make the design feel cramped.

Choose the hero model before choosing dimensions

Text-led hero

Use a content-sized section. Constrain the copy with a max-width, add responsive horizontal and vertical padding, and keep the heading, supporting text and call to action in normal document flow. This is the safest model for accessibility and localization because the section can expand.

Image-led hero

If the image is the main message, define a media frame with CSS aspect-ratio. The property expresses a preferred width-to-height ratio and helps the browser reserve space before the image arrives, reducing layout shift. See MDN’s aspect-ratio guide.

Split text-and-image hero

Use a grid or flex layout at wide widths and stack the columns when the available width becomes too narrow for comfortable text. The breakpoint should be where your content stops fitting, not a device brand or a presumed “tablet” width. web.dev recommends layouts that are not dependent on one viewport width.

Image ratio, crop and focal point

Choose whether the image must fill a designed frame or remain completely visible:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Requirement CSS behavior Trade-off
Fill the frame and accept cropping object-fit: cover The image keeps its ratio, but edges are cropped.
Show the entire image object-fit: contain No cropping, but empty space may appear.
Keep a subject visible during cropping object-position, for example center 30% Favors the focal area and may crop more of the opposite edge.

These behaviors and their limitations are documented in web.dev’s responsive-images guide. Art-direct the focal point for narrow screens when a desktop crop would remove a face, product or essential text in the artwork. Never place essential words only inside a background image; they cannot reflow, be selected or be read reliably by assistive technology.

A robust responsive hero pattern

The following example uses a content-sized section, a two-column layout that stacks naturally, and an image ratio that applies only to the media box.

<meta name="viewport" content="width=device-width, initial-scale=1">

<section class="hero" aria-labelledby="hero-title">
  <div class="hero__copy">
    <p class="hero__eyebrow">Release 4.2</p>
    <h1 id="hero-title">Ship your next launch with confidence</h1>
    <p>Monitor every deployment from one clear workspace.</p>
    <a class="hero__cta" href="/start">Start free</a>
  </div>
  <div class="hero__media">
    <img
      src="/images/dashboard-960.webp"
      srcset="/images/dashboard-640.webp 640w,
              /images/dashboard-960.webp 960w,
              /images/dashboard-1440.webp 1440w"
      sizes="(max-width: 800px) 100vw, 50vw"
      width="1440" height="1080"
      alt="Deployment dashboard showing a successful release">
  </div>
</section>

<style>
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: center;
  max-width: 72rem;
  margin-inline: auto;
  padding: clamp(3rem, 9vw, 8rem) clamp(1rem, 4vw, 3rem);
}
.hero__copy { max-width: 38rem; }
.hero h1 {
  font-size: clamp(2.25rem, 6vw, 5rem);
  line-height: 1.05;
  text-wrap: balance;
}
.hero__copy > p { max-width: 38rem; }
.hero__media { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 1rem; }
.hero__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
}
</style>

The viewport declaration uses the device width, as recommended by MDN. It also preserves normal zoom; do not disable zoom with restrictive viewport settings. The image’s width and height attributes communicate its intrinsic ratio before loading, a practice covered by web.dev.

Should a hero section be 100vh?

100vh is not a universal recommendation. A full-viewport hero can work for a focused landing screen, but it can also hide the next section, clip content on short screens, or behave awkwardly when mobile browser UI changes the visual viewport. If you use viewport units, treat them as a flexible bound rather than a hard clipping height:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.hero--full {
  min-height: 100svh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
}

Keep the content in normal flow and allow the section to grow beyond the viewport. Test with long headings, increased text size and zoom. A content-first hero is usually a better default than forcing every page into exactly one screen.

Responsive image loading and stability

Reserve space before the request completes

Provide accurate width and height attributes or an aspect-ratio on the media wrapper. This lets the browser calculate the box early and prevents surrounding content from jumping.

Do not lazy-load the above-the-fold hero

web.dev advises against lazy-loading a prominent hero image. It is visible immediately, so delaying it can slow the first impression. A high fetch priority can be appropriate when the image is genuinely vital, but prioritizing one resource changes the priority available to others; use it selectively.

Use responsive sources

Use srcset and sizes so a narrow device does not download a desktop-sized file. The browser chooses a suitable source while CSS controls the rendered box. Do not assume that a 2,400-pixel export should be displayed at 2,400 CSS pixels.

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

How to select dimensions in practice

  1. Inventory the content. Write the longest expected heading, body copy, labels and translated versions. Include the real CTA text.
  2. Set a readable text measure. Constrain the copy column so lines do not become excessively long, and leave room for the button to wrap or stack.
  3. Choose a media ratio only if needed. Pick a ratio that matches the composition; do not impose the same ratio on every hero.
  4. Build fluid spacing. Use relative units or clamp() for padding and type so the section scales between viewports.
  5. Define a content-driven layout change. Stack columns when the heading, copy and image no longer fit comfortably, regardless of the exact device width.
  6. Check the actual extremes. Inspect narrow and wide windows, landscape orientation, increased browser zoom, larger system text and the longest heading.
  7. Inspect loading behavior. Confirm that the image reserves space, the visible hero is not lazy-loaded, and no horizontal scrollbar appears.

Testing checklist for a production hero

  • Text fit: the heading, supporting copy and CTA remain visible without clipping at every tested width.
  • Zoom: browser zoom and text enlargement do not overlap controls or hide content.
  • Crop: the focal subject survives the narrowest crop; adjust object-position or use an art-directed source if it does not.
  • Overflow: long URLs, buttons and images do not create horizontal scrolling.
  • Stability: the page does not jump when the hero image loads.
  • Performance: the above-the-fold image starts promptly and is not competing unnecessarily with critical CSS or fonts.
  • Accessibility: the heading order is logical, contrast remains sufficient over imagery, keyboard focus is visible, and image alt text describes meaningful content.

Common mistakes and fixes

“The hero must be 1920 × 800 pixels.”

That is an asset export, not a responsive rule. Make the section fluid and define a ratio for the image box only when composition requires it.

Content disappears on phones

Look for a fixed height, overflow: hidden, or absolutely positioned text. Remove the rigid height, let content determine the minimum size, and re-check at increased zoom.

The subject is cut off

object-fit: cover is doing exactly what it promises: filling the frame by cropping. Change object-position, switch to contain, change the ratio, or provide a mobile-specific crop.

A blank band appears beside the image

This is the expected trade-off of contain. Use a matching background color, a different frame ratio, or cover if cropping is acceptable.

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.

The page jumps when the hero loads

Add correct image dimensions or an aspect-ratio wrapper. Verify that CSS does not replace the reserved dimensions with an auto-sized box after the request begins.

The mobile page feels slow

Check that the image uses srcset and sizes, that the visible hero is not lazy-loaded, and that any high fetch priority is reserved for the truly critical image.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Horizontal scrolling appears only at one width

Use browser devtools to identify the overflowing element. Common causes are a fixed-width child, an unbreakable string, a grid track without minmax(0, 1fr), or an image missing max-width: 100%.

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

Or skip the browser setup

After you build the page, you can verify its real rendered hero with ScreenshotNeo, a website screenshot API and MCP server. It accepts the cookie or consent banner before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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.

One GET request returns PNG, JPEG, WebP or PDF. The API supports full-page captures with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or a custom viewport, retina scale, custom CSS and JavaScript, clicks, waits, blocked requests, cookies, headers, user agents, timezone and geolocation. You can also use caching with a chosen TTL, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which helps when switching.

See the ScreenshotNeo documentation for all options. The same request can be used from a shell, Python or Node.js:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Pricing is straightforward: Free includes 1,000 shots per month with no card; Starter is $5 for 3,000; Growth $15 for 15,000; Pro $39 for 60,000; Scale $99 for 250,000; and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients, so AI agents can inspect responsive states directly.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

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

FAQ

What is the best hero image size for desktop and mobile?

Use responsive sources and let CSS determine the rendered size. Choose an image ratio that suits the composition, then provide a crop or art direction that keeps the focal subject visible on narrow screens.

Should every hero use the same aspect ratio?

No. A product screenshot, portrait, illustration and editorial photograph may need different ratios. Standardize only where a consistent visual system is an intentional requirement.

Can I use a background image instead of an img element?

Yes for decorative imagery, but use an img when the image conveys content that needs meaningful alternative text, intrinsic dimensions or responsive source selection.

Frequently Asked Questions

What is the best hero image size for desktop and mobile?

Use responsive sources and let CSS determine the rendered size. Choose an image ratio that suits the composition, then provide a crop or art direction that keeps the focal subject visible on narrow screens.

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

Should every hero use the same aspect ratio?

No. A product screenshot, portrait, illustration and editorial photograph may need different ratios. Standardize only where a consistent visual system is an intentional requirement.

Can I use a background image instead of an img element?

Yes for decorative imagery, but use an img when the image conveys content that needs meaningful alternative text, intrinsic dimensions or responsive source selection.

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
$14.18
SaleBestseller No. 3
SaleBestseller No. 4
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.