Sub topic 9
Lay out the hero above the fold
This chapter assumes you can write HTML and CSS Grid, know what a media query is, and have read the earlier chapters on the headline, subheadline and call to action (CTA). Here you place those pieces on the screen so a visitor sees the whole offer before scrolling.
What "above the fold" means on the web
The fold is the bottom edge of the browser window when the page first loads. Anything below it needs a scroll. Unlike a newspaper, the web has no single fold. It sits at a different height on a 1440×900 laptop, a 390×844 phone and a landscape tablet. Browser toolbars, cookie banners and sticky headers also reduce the visible height.
You cannot guarantee that everything fits for every visitor. You can set a priority order and make sure the essential items sit in the first screen on the most common devices.
The essential items are:
- The headline that states the offer.
- The subheadline that names the audience and mechanism.
- The primary CTA.
- Some sign of the product, so the visitor knows what they are getting.
Social proof, secondary links and decorative elements come after those four.
Budget the first screen
Treat the first screen as a space budget. Start with a realistic small viewport. For phones, 360×640 CSS pixels is a common conservative choice. For desktops, 1366×768 is a reasonable floor. Then subtract what you do not control:
| Item | Typical height | Notes |
|---|---|---|
| Browser chrome on phones | 60–120 px | Varies as the address bar collapses |
| Site header | 56–80 px | Smaller if the header is not sticky |
| Cookie or consent banner | 80–200 px | Often covers the bottom, and the CTA with it |
| Hero top padding | 24–48 px | Reduce on small screens |
On a 360×640 phone, that can leave roughly 380 to 450 px for the hero. A 32 px headline wrapping onto four lines uses about 150 px. A three-line subheadline uses about 90 px. The CTA with its padding uses about 50 px. Together that is about 290 px, which fits, but a large image placed above the text would push the CTA off screen.
This is why the order in the source matters on narrow screens. Put the text and CTA first, and let the image fall below them or shrink.
Choose a layout pattern
Three patterns cover most heroes.
| Pattern | Structure | Works best when | Main risk |
|---|---|---|---|
| Split | Text in one column, visual in the other | The visual shows the product, such as a screenshot | Columns stack on phones, so the image can push content down |
| Centered stack | Headline, subheadline and CTA centered, visual below | The offer is simple and the visual is secondary | The visual falls below the fold on short screens |
| Full-bleed background | Text over a wide image or video | The mood matters more than product detail | Text contrast and loading cost |
The Ledgerly example uses the split pattern. It suits a product whose value is visible in its interface, since the screenshot of the invoice editor backs up the headline.
The following diagram shows how to check whether a layout holds up.
Build the split layout
The grid from the spine is the base. On a narrow screen it is a single column, so the text comes first and the image follows. At 48rem and wider it becomes two equal columns.
.hero {
display: grid;
gap: 2rem;
align-items: center;
padding: 3rem 1.25rem;
max-width: 72rem;
margin-inline: auto;
}
@media (min-width: 48rem) {
.hero {
grid-template-columns: 1fr 1fr;
}
}Source order controls the stacked order. In the HTML, .hero__text comes before the image, so on a phone the visitor reads the offer first. Do not use CSS order to move the image above the text on mobile unless you have a reason, because keyboard and screen reader users follow the source order, not the visual order.
Equal columns are a default, not a rule. If the text is short and the screenshot is detailed, give the visual more room, for example grid-template-columns: 5fr 7fr;. Keep the text column wide enough that the headline wraps to no more than three or four lines at desktop size.
Control the hero height
Two common mistakes pull in opposite directions. One is a hero with no height control, which can end up so short that the next section crowds it. The other is min-height: 100vh, which forces the hero to fill the screen.
The 100vh approach has a known problem on phones. On mobile browsers, 100vh is measured as if the address bar were hidden. When the page loads with the bar visible, the hero is taller than the visible area and the CTA can sit below the fold. Modern CSS has viewport units that avoid this:
svhis the small viewport height, measured with browser toolbars showing.lvhis the large viewport height, measured with toolbars hidden.dvhis the dynamic viewport height, which changes as the toolbars appear and disappear.
For a hero, svh is the safest choice, because it guarantees that the space you size to is always visible. dvh can cause the layout to jump during scrolling.
:root {
--header-h: 4rem;
}
.hero {
/* Fallback for browsers without svh support */
min-height: 30rem;
/* Never taller than the first screen minus the header, never taller than 40rem */
min-height: min(40rem, calc(100svh - var(--header-h)));
}This keeps the hero from growing beyond the screen on tall displays, and it sets a floor so that content has room. Because it is min-height and not height, the hero still grows if the text wraps more than expected. That matters for translated copy, larger user font sizes and 200% zoom.
Avoid overflow: hidden on the hero. It hides content that does not fit instead of letting the layout grow, and that content is often the CTA.
Let the next section peek
A hero that exactly fills the screen can look like the whole page. Visitors may not realize they can scroll. A common fix is to size the hero a little shorter than the viewport so the top edge of the next section shows. This hint of more content works better than an animated arrow.
In the CSS above, the calc(100svh - var(--header-h)) value can be reduced a bit more, for example by 3rem, to leave room for the peek. Check this on the real next section. Social proof, such as a row of customer logos, works well here because it is short and supports the offer.
Handle sticky headers and banners
A sticky header takes space from every screen, and the hero should account for it. The --header-h custom property above is one way to keep the header height and the hero calculation in one place. If the header height changes at a breakpoint, update the variable there:
@media (min-width: 48rem) {
:root {
--header-h: 5rem;
}
}Cookie banners are harder. They are often injected by a third-party script and overlay the bottom of the screen. Test the hero with the banner showing. If it covers the CTA on a small phone, reduce the hero's vertical padding on small screens or ask for a banner that is more compact. Do not fix this by hiding the banner, because that may be a legal requirement.
A complete example
This page contains the hero HTML, the layout CSS and a short next section. Save it as a file and open it in a browser. The image path will not resolve unless you add a file there, but the layout still works and the alt text shows.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Ledgerly</title>
<style>
:root { --header-h: 4rem; }
body { margin: 0; font-family: system-ui, sans-serif; }
.site-header { height: var(--header-h); display: flex; align-items: center; padding: 0 1.25rem; }
.hero {
display: grid; gap: 2rem; align-items: center;
padding: 2rem 1.25rem; max-width: 72rem; margin-inline: auto;
min-height: 30rem;
min-height: min(40rem, calc(100svh - var(--header-h) - 3rem));
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; margin: 0 0 1rem; }
.hero__sub { font-size: 1.125rem; max-width: 40ch; margin: 0 0 1.5rem; }
.hero__cta { display: inline-block; padding: 0.875rem 1.5rem; background: #0b5fff; color: #fff; border-radius: 0.5rem; font-weight: 600; text-decoration: none; }
.hero__image { width: 100%; height: auto; }
@media (min-width: 48rem) {
:root { --header-h: 5rem; }
.hero { grid-template-columns: 1fr 1fr; }
}
</style>
</head>
<body>
<header class="site-header"><strong>Ledgerly</strong></header>
<section class="hero" aria-labelledby="hero-title">
<div class="hero__text">
<h1 id="hero-title">Send invoices in under a minute</h1>
<p class="hero__sub">Ledgerly helps freelancers create, send and track invoices, so you get paid sooner.</p>
<a class="hero__cta" href="/signup">Start free trial</a>
</div>
<img class="hero__image" src="/img/invoice-editor.webp" width="640" height="400" alt="Ledgerly invoice editor showing a draft invoice with a Send button">
</section>
<section style="padding: 2rem 1.25rem; background: #f3f5f9;">
<p>Trusted by 4,000 freelancers.</p>
</section>
</body>
</html>Common errors
- Image above the text on mobile. The CTA is pushed below the fold. Keep the text first in the source.
height: 100vhwithoverflow: hidden. The CTA is clipped on phones. Usemin-heightwithsvh.- Headline too large on small screens. A fixed 4rem headline can fill the whole phone screen. The
clamp()in the example sets a floor and a ceiling. - Ignoring the header. The hero height is calculated from the full viewport, so the real visible space is smaller than planned.
- Too many elements. Adding a second button, a badge and a video competes with the primary CTA and uses space the budget does not have.
Exercise
A hero uses min-height: 100vh and overflow: hidden. On a phone with the address bar visible, the "Start free trial" button is cut off. Give two changes that fix this and say why each works.
Show answer
First, replace 100vh with 100svh (or min(40rem, calc(100svh - var(--header-h)))). On mobile, 100vh is measured with the address bar hidden, so the hero is taller than the visible area. svh uses the height with toolbars showing. Second, remove overflow: hidden. With it, any content that does not fit is clipped. Without it, min-height lets the hero grow so the button stays reachable.
Exercise
Why should the source order in the HTML be text first and image second, even if the design shows the image on the left at desktop width?
Show answer
On narrow screens the grid collapses to one column in source order, so the text and CTA stay above the image. Keyboard and screen reader users also follow source order. Moving the image first with CSS order would change the visual order but not the reading order, which creates a mismatch. If the image must appear on the left at desktop, use grid-column placement or direction tricks sparingly, and keep the DOM order meaningful.