SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/hero-sections

8 CSS Hero Sections

8 Pure CSSPublished 2026-10-04Free · no sign-up

Eight hero sections for the top of a landing page: a centred hero with two buttons, a split layout with a product mock-up, an animated gradient, a waitlist signup, text over a full-bleed image, proof points, a typographic portfolio hero and an app download hero.

01. Centred Hero with Two Buttons

LandingHero

A centred hero with an eyebrow line, a large headline that scales with clamp(), a supporting sentence and primary and secondary buttons. The headline is the page's h1, the line length is capped for readability, and the layout needs no media queries.

View code
<section class="hc">
  <p class="eb">For independent makers</p>
  <h1>Sell your work without the busywork</h1>
  <p class="lead">Stock, orders and shipping labels in one calm dashboard, so you can get back to making.</p>
  <div class="cta"><a href="#" class="p">Start free</a><a href="#" class="s">See how it works</a></div>
</section>
.hc { max-width: 640px; padding: 20px; text-align: center; font-family: Inter, system-ui, sans-serif; }
.eb { margin: 0 0 12px; color: #6941c6; font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.hc h1 { margin: 0; color: #101828; font-size: clamp(30px, 6vw, 52px); line-height: 1.08; letter-spacing: -.03em; }
.lead { max-width: 46ch; margin: 16px auto 26px; color: #475467; font-size: 18px; line-height: 1.55; }
.cta { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cta a { padding: 12px 20px; border-radius: 12px; font-weight: 700; text-decoration: none; }
.p { background: #6941c6; color: #fff; }
.s { border: 1.5px solid #d0d5dd; color: #101828; }
.cta a:focus-visible { outline: 2px solid #6941c6; outline-offset: 3px; }

02. Split Hero with Product Visual

LandingGrid

Text on the left and a product visual on the right, the most common SaaS hero. CSS Grid places the two halves and stacks them on phones with the text first; the visual is a CSS mock-up of a dashboard so the demo needs no images.

View code
<section class="hs">
  <div>
    <h1>Know what to restock, before it runs out</h1>
    <p>Forecasts from your real sales, sent to your inbox every Monday.</p>
    <a href="#">Try it free for 14 days</a>
  </div>
  <div class="mock" role="img" aria-label="Dashboard showing a sales chart and three low-stock items"><span class="ch"></span><span class="row"></span><span class="row"></span><span class="row s"></span></div>
</section>
.hs { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 32px; width: min(760px, 94vw); font-family: Inter, system-ui, sans-serif; }
.hs h1 { margin: 0; color: #fff; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -.02em; }
.hs p { margin: 14px 0 22px; color: #aab3c7; font-size: 17px; line-height: 1.55; }
.hs a { display: inline-block; padding: 12px 18px; border-radius: 12px; background: #22d3ee; color: #062a33; font-weight: 800; text-decoration: none; }
.hs a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.mock { display: grid; gap: 10px; padding: 16px; border: 1px solid #2c3346; border-radius: 16px; background: #12161f; box-shadow: 0 30px 60px -30px rgba(34,211,238,.4); }
.mock span { display: block; border-radius: 8px; background: #1e2433; }
.ch { height: 110px; background: linear-gradient(180deg, transparent 40%, rgba(34,211,238,.25)), linear-gradient(135deg, #1e2433, #262d3e) !important; }
.row { height: 14px; }
.row.s { width: 60%; }
@media (max-width: 620px) { .hs { grid-template-columns: 1fr; } }

03. Animated Gradient Hero

GradientAnimation

A bold hero over a slowly shifting gradient, with a headline that has one gradient word. The background animates background-position over twenty seconds, slow enough not to distract, and stops completely for people who prefer reduced motion.

View code
<section class="hg">
  <h1>Design that feels <span>effortless</span></h1>
  <p>Websites for small brands, built in weeks, not months.</p>
  <a href="#">Book a call</a>
</section>
.hg { box-sizing: border-box; max-width: 100%; display: grid; justify-items: center; gap: 14px; width: min(680px, 94vw); padding: 60px 24px; border-radius: 24px; background: linear-gradient(120deg, #1e1b4b, #4c1d95, #0f766e, #1e1b4b) 0 0 / 300% 300%; animation: hg 20s ease infinite; text-align: center; font-family: Inter, system-ui, sans-serif; }
@keyframes hg { 50% { background-position: 100% 100%; } }
.hg h1 { margin: 0; color: #fff; font-size: clamp(30px, 5.5vw, 50px); line-height: 1.08; letter-spacing: -.03em; }
.hg span { background: linear-gradient(90deg, #5eead4, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hg p { margin: 0; color: #ddd6fe; font-size: 17px; }
.hg a { margin-top: 8px; padding: 12px 22px; border-radius: 999px; background: #fff; color: #1e1b4b; font-weight: 800; text-decoration: none; }
.hg a:focus-visible { outline: 2px solid #5eead4; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hg { animation: none; } }

04. Hero with Email Signup

Lead captureForm

A launch or waitlist hero with an inline email form under the headline. The input and button sit on one line on wider screens and stack on phones, the input has a real label, and a small privacy note sits right under the form.

View code
<section class="he">
  <h1>Be first to try Harbor</h1>
  <p>We are opening the beta to 500 shops in November.</p>
  <form onsubmit="event.preventDefault()">
    <label for="he-e" class="sr">Email address</label>
    <input id="he-e" type="email" autocomplete="email" placeholder="you@shop.com" required>
    <button>Join the waitlist</button>
  </form>
  <small>One email when your invite is ready. No spam.</small>
</section>
.he { display: grid; justify-items: center; gap: 12px; width: min(560px, 94vw); text-align: center; font-family: Inter, system-ui, sans-serif; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.he h1 { margin: 0; color: #101828; font-size: clamp(30px, 5vw, 46px); letter-spacing: -.03em; }
.he p { margin: 0 0 8px; color: #475467; font-size: 17px; }
.he form { display: flex; gap: 8px; width: 100%; max-width: 440px; }
.he input { flex: 1; min-width: 0; padding: 12px 14px; border: 1.5px solid #d0d5dd; border-radius: 12px; font: 15px Inter, sans-serif; outline: none; }
.he input:focus { border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.he button { padding: 12px 18px; border: 0; border-radius: 12px; background: #0f766e; color: #fff; font: 700 15px Inter, sans-serif; cursor: pointer; }
.he small { color: #5d6679; }
@media (max-width: 460px) { .he form { flex-direction: column; } }

05. Full-Bleed Image Hero

OverlayPhoto

A hero with text over a full-bleed background, here a CSS gradient standing in for a photo. A dark gradient overlay sits between image and text so the headline stays readable whatever the picture, which is the main risk of text-on-image heroes.

View code
<section class="hi">
  <div class="txt">
    <p>New season</p>
    <h1>Linen for warm evenings</h1>
    <a href="#">Shop the collection</a>
  </div>
</section>
.hi { position: relative; display: flex; align-items: flex-end; width: min(680px, 94vw); height: 360px; overflow: hidden; border-radius: 22px; background: radial-gradient(circle at 70% 30%, #fde68a, transparent 40%), linear-gradient(160deg, #d97706, #9a3412 60%, #431407); font-family: Inter, system-ui, sans-serif; }
.hi::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(10,8,6,.8)); }
.txt { position: relative; padding: 32px; }
.txt p { margin: 0 0 6px; color: #fde68a; font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.txt h1 { margin: 0 0 16px; color: #fff; font-size: clamp(28px, 5vw, 46px); line-height: 1.05; }
.txt a { display: inline-block; padding: 11px 18px; border-radius: 999px; background: #fff; color: #431407; font-weight: 800; text-decoration: none; }
.txt a:focus-visible { outline: 2px solid #fde68a; outline-offset: 3px; }

06. Hero with Proof Points

LandingStats

A hero followed by three short proof points such as delivery speed and return window, laid out as a definition list. Use facts you can stand behind; the numbers here are placeholders to replace with your own verified figures.

View code
<section class="hp">
  <h1>Handmade ceramics, shipped with care</h1>
  <p>Every piece is wrapped by hand in recycled packaging.</p>
  <dl>
    <div><dt>Ships in</dt><dd>2 days</dd></div>
    <div><dt>Free returns</dt><dd>30 days</dd></div>
    <div><dt>Made in</dt><dd>Our studio</dd></div>
  </dl>
</section>
.hp { width: min(620px, 94vw); text-align: center; font-family: Inter, system-ui, sans-serif; }
.hp h1 { margin: 0; color: #101828; font-size: clamp(28px, 5vw, 44px); line-height: 1.1; letter-spacing: -.02em; }
.hp > p { margin: 12px 0 28px; color: #475467; font-size: 17px; }
.hp dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid #e4e7ec; border-radius: 16px; background: #fff; }
.hp dl div { padding: 18px 10px; }
.hp dl div + div { border-left: 1px solid #e4e7ec; }
.hp dt { color: #5d6679; font-size: 13px; }
.hp dd { margin: 4px 0 0; color: #101828; font-size: 22px; font-weight: 800; }
@media (max-width: 460px) { .hp dl { grid-template-columns: 1fr; } .hp dl div + div { border-left: 0; border-top: 1px solid #e4e7ec; } }

07. Minimal Typographic Hero

PortfolioType

A portfolio hero that relies on type alone: a very large statement in two weights, a short line about the person and a text link. Generous whitespace and a narrow measure create the impact, with no images, buttons or background effects.

View code
<section class="hm">
  <h1>Independent designer <em>making calm, useful websites.</em></h1>
  <p>Currently booking projects for January.</p>
  <a href="#">See selected work &rarr;</a>
</section>
.hm { width: min(620px, 94vw); font-family: Inter, system-ui, sans-serif; }
.hm h1 { margin: 0; color: #fff; font-size: clamp(30px, 5.5vw, 54px); font-weight: 800; line-height: 1.05; letter-spacing: -.035em; }
.hm em { color: #8b95a9; font-style: normal; font-weight: 500; }
.hm p { margin: 26px 0 10px; color: #aab3c7; font-size: 16px; }
.hm a { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 5px; }
.hm a:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

08. App Download Hero

Mobile appBadges

A hero for a mobile app with store buttons and a phone mock-up drawn in CSS. The store buttons are links with full accessible names; replace them with the official App Store and Google Play badge artwork, which their brand guidelines require.

View code
<section class="ha">
  <div>
    <h1>Your shop, in your pocket</h1>
    <p>Take orders, reply to customers and print labels from your phone.</p>
    <div class="stores"><a href="#">Download on the App Store</a><a href="#">Get it on Google Play</a></div>
  </div>
  <div class="phone" role="img" aria-label="Phone showing the orders screen"><span class="nt"></span><span class="c"></span><span class="c"></span><span class="c s"></span></div>
</section>
.ha { box-sizing: border-box; max-width: 100%; display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 28px; width: min(700px, 94vw); font-family: Inter, system-ui, sans-serif; }
.ha h1 { margin: 0; color: #101828; font-size: clamp(28px, 4.5vw, 42px); line-height: 1.1; letter-spacing: -.02em; }
.ha p { margin: 12px 0 20px; color: #475467; font-size: 16px; line-height: 1.55; }
.stores { display: flex; flex-wrap: wrap; gap: 8px; }
.stores a { padding: 10px 14px; border-radius: 10px; background: #101828; color: #fff; font-weight: 700; font-size: 13px; text-decoration: none; }
.stores a:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.phone { justify-self: center; display: grid; align-content: start; gap: 10px; width: 160px; height: 320px; padding: 30px 12px 12px; border: 8px solid #101828; border-radius: 32px; background: #f2f4f7; position: relative; }
.nt { position: absolute; top: 8px; left: 50%; width: 50px; height: 8px; border-radius: 4px; background: #101828; transform: translateX(-50%); }
.c { height: 54px; border-radius: 12px; background: #fff; box-shadow: 0 2px 6px rgba(16,24,40,.08); }
.c.s { height: 34px; }
@media (max-width: 560px) { .ha { grid-template-columns: 1fr; } }

About these CSS Hero Sections

One clear message

A hero has a few seconds to say what you offer. Use one h1 that states the benefit plainly, one supporting sentence and one primary action; a secondary link can sit beside it for people who want to learn more first.

Fluid type

font-size: clamp(30px, 6vw, 52px) lets the headline grow with the screen between a minimum and a maximum, so one rule works from phones to desktops without media queries.

Text over images

When text sits on a photo, add a dark gradient overlay between them so the text keeps its contrast whatever the picture. Test with the brightest image you might use.

Proof you can stand behind

Numbers and badges in a hero build trust only if they are true. The proof-points demo uses placeholders such as delivery days; replace them with figures you can verify.

Frequently asked questions

Do hero sections need JavaScript?

None of these do.

How tall should a hero be?

Tall enough to show the message and action without scrolling on common screens; avoid full-screen heroes that push all content below the fold.

How do I keep the hero fast?

Avoid huge background videos, size images for the screen, and let the headline load as text, not as an image.