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.

There is no universal pixel width or height for a website hero section. Its dimensions should adapt to the content and available viewport. Let the heading, supporting text, and call to action fit comfortably; size any image independently, using a responsive frame and an intentional crop. The right result is the one that stays readable and useful on narrow and wide screens, including when visitors zoom.

What size should a website hero section be?

Think of a hero as a layout region, not an image export with a fixed display size. A rigid desktop width can create horizontal scrolling on a narrow screen, while a rigid height can clip text when a heading wraps or a visitor enlarges the page. MDN describes responsive web design as an approach for adapting layouts to a range of devices and viewport sizes, rather than designing for one assumed screen. MDN’s responsive web design guide explains the principle.

Choose the section’s size from its job. A text-led hero needs enough room for its heading, supporting copy, and action. An image-led hero needs a frame that preserves the composition or a crop that keeps the important subject visible. A combined hero must accommodate both without making the text hard to read or the image secondary content impossible to see.

That is why a single “best desktop and mobile size” or a standard hero height is misleading. The image file’s pixel dimensions are not the hero’s rendered dimensions: CSS lays out the section according to its container and viewport. No universal hero width or height is established by the cited guidance.

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

Set the layout from its content

Let text determine the minimum height

Start with the longest likely heading, the supporting text, and the call to action. Allow enough room for them to wrap naturally. Prefer flexible padding and layout behavior over a fixed height that assumes the copy will always occupy the same number of lines. Check that the content remains visible at narrow widths and with increased text size or browser zoom.

Make the viewport match the device

Include the device-width viewport setting so the page’s layout viewport corresponds to the device width on narrow screens:

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

MDN documents width=device-width for this purpose in its viewport meta element reference. Do not disable zoom to make a hero appear to fit; people should be able to enlarge page content. Flexible layouts are preferable to assuming one particular viewport width, as discussed in web.dev’s accessible responsive design guidance and responsive web design basics.

Use a ratio for the image frame, not a fixed section height

If an image needs a stable shape as its width changes, give the image frame an aspect ratio. CSS aspect-ratio expresses a preferred width-to-height relationship; it does not dictate the total height of a text-and-image hero. MDN explains how aspect ratios preserve a box’s shape and can help reserve space before media loads. See MDN’s aspect-ratio guide.

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

For example, this is a starting point to adapt—not a universal hero specification. The chosen image ratio and column arrangement should suit the actual design:

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  padding: 3rem 1.5rem;
}

.hero__image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 40rem) {
  .hero {
    grid-template-columns: 1fr;
  }
}

The example uses a sample ratio and breakpoint to demonstrate flexible behavior, not prescribed values. Change the layout when the content needs it: the heading’s wrapping, text length, image subject, and usable space matter more than matching a named device size.

Choose whether the image should crop or stay whole

Use cover when the frame should be filled

object-fit: cover keeps an image’s proportions while scaling it to fill its box, cropping parts that do not fit. That works when filling the designed frame is more important than showing every edge of the source image. Set object-position to move the focal point within the crop—for example, toward a face or product that would otherwise be cut off.

Use contain when the entire image matters

object-fit: contain preserves the full image, but may leave unfilled space inside the frame. Use it when cutting off any part of the image would remove important information, and design the surrounding space deliberately. The behavior of cover, contain, and object-position is covered in web.dev’s responsive images guide.

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

Inspect the actual image at both wide and narrow layouts. A crop that looks balanced on a desktop can hide its focal point when the frame changes shape. If the image must remain fully visible, do not choose a crop merely to make the frame look full.

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

Reserve image space and load the prominent image appropriately

When an image’s intrinsic dimensions are known, include its width and height attributes in the HTML. These let the browser infer its ratio and account for the image’s space before it loads, reducing layout movement around it. The rendered size can still be responsive through CSS; the attributes do not require the image to display at those dimensions. web.dev’s responsive images guidance covers dimension hints and responsive scaling.

Do not lazy-load an above-the-fold hero image that is immediately prominent. web.dev advises loading such an image promptly. A high fetch priority may help when that image is truly vital, but prioritizing one resource affects the others competing to load, so it should not be applied indiscriminately. Keep the priority decision tied to the page’s real loading needs.

Check the hero across viewports and zoom levels

Use the browser’s responsive viewport controls or resize the window, and inspect the actual page rather than judging from a desktop image export. Check a narrow layout, a wide layout, and the widths where the content starts to feel crowded; change the layout at those points instead of targeting a device label.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Load the page with the device-width viewport setting in place.
  2. At narrow widths, confirm there is no horizontal overflow and that the heading, copy, image, and action remain visible.
  3. At wide widths, check that text does not become uncomfortably stretched and the hero still reads as one coherent section.
  4. Increase text size or browser zoom. Confirm that wrapping does not clip content, cover the action, or force visitors to scroll sideways.
  5. Inspect the image crop at each layout. Adjust object-position or use contain if the important subject or full image is not visible as intended.
  6. Reload with the network panel open and observe whether the hero image reserves space and loads promptly rather than appearing late and shifting nearby content.

These are implementation checks, not a claim that a particular design has been tested. Responsive guidance focuses on flexible behavior across viewport sizes rather than one fixed breakpoint or pixel pair.

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

Troubleshoot common hero layout problems

  • The page scrolls sideways on a phone: Look for a fixed-width child, an image wider than its container, or a rigid hero width. Let the layout follow its container and allow columns to stack when the content no longer fits.
  • The heading or button is cut off: A fixed hero height may not allow for wrapped text or zoom. Remove the rigid height or make it a minimum, then let content determine the section’s needed space.
  • The subject disappears in a narrow crop: Reposition the image with object-position, revise the frame ratio, or use contain if the whole source must remain visible.
  • The whole image is visible but awkward empty space appears: That is a normal consequence of contain when the source and frame ratios differ. If a crop is acceptable, use cover; otherwise treat the empty area as part of the design.
  • Content jumps when the image loads: Add known image width and height attributes so the browser can reserve space from the image ratio.
  • The prominent image loads too late: Check that an above-the-fold hero image is not lazy-loaded. Consider high fetch priority only if the image is genuinely vital, since this changes resource prioritization.

Or skip the browser setup

For repeatable screenshots of a page while you review its responsive layout, ScreenshotNeo is a website screenshot API and MCP server. A GET request can return a PNG, JPEG, WebP, or PDF. For a quick capture, replace the example URL with the page you want to inspect. Keep your API key private; do not expose it in public client-side code. Read the ScreenshotNeo API documentation.

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. 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

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

Python

import requests

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

Node.js

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

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month with no card.

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.