HTML Formatterhtmlformatteronline.com

Gradient hero with search

A full-bleed gradient hero with a prominent search field.

herogradientsearchdarklanding
<section class="hero">
  <div class="inner">
    <h1>Every UK postcode, one lookup away</h1>
    <p class="lede">Two million addresses, updated weekly from Royal Mail. Free for up to
    a thousand lookups a month.</p>

    <form class="finder" role="search">
      <label class="sr" for="q">Postcode or street</label>
      <svg class="icon" viewBox="0 0 24 24" aria-hidden="true">
        <circle cx="11" cy="11" r="7"/><path d="M20 20l-4.3-4.3"/>
      </svg>
      <input type="search" id="q" name="q" placeholder="LS1 4DT or Mill Lane, Leeds" autocomplete="off">
      <button type="submit">Look up</button>
    </form>

    <p class="hint">Try <a href="#">SW1A 1AA</a>, <a href="#">EH1 1YZ</a> or <a href="#">BT1 5GS</a></p>
  </div>
</section>

How it works

Three gradients stacked, not one. Two soft radial washes over a linear base. A single two-stop linear gradient always looks like a template; layering a couple of large, low-opacity radials over it gives depth without any image. The gradient generator will build the individual layers.

The solid colour above the gradient is a real fallback. A browser that does not understand one of the gradient functions discards that whole declaration and keeps the previous one. Two lines, and the difference between a dark hero and white text on white.

The lede is not pure white. #d4dcf2 rather than #fff. Maximum contrast on every element flattens the hierarchy and is genuinely more tiring to read on a dark background. The headline keeps full white; the supporting text steps back.

The search field is white, not translucent. A glassy input over a gradient looks good in a mockup and fails contrast in practice, because the background behind the text changes across the field. The frosted treatment is on the container around it, where no text sits.

The icon is pointer-events: none. Without it, clicking the magnifying glass does nothing instead of focusing the field — a small thing that people notice.

Accessibility notes

The search field has a real label, visually hidden with clip-path rather than display: none, which would hide it from screen readers as well.

role="search" on the form makes it a landmark, so a screen reader user can jump straight to it.

Contrast is the risk with any gradient. Check the headline against the lightest point of the gradient and the darkest, not just the middle — automated checkers sample one pixel and will pass a combination that fails in the corner.

The focus outline on the input is white with an offset, so it stays visible against the gradient. A default browser outline frequently disappears on a coloured background.

Making it yours

Change the three gradient layers and the whole hero changes character. Keep the radials large and faint; small, strong ones read as blobs.

backdrop-filter is decorative here. If it is unsupported the container falls back to a flat translucent panel, which is fine.

For a light version, invert the colours and drop the layer opacities to around 0.15 — gradients that look subtle on dark are usually far too strong on white.

Related templates

Check your version

Once you have edited this, the HTML validator will catch any tag you left unclosed, and the formatter will tidy the indentation. Both run in your browser.