Hero Section Code — Copy & Paste
The exact hero pattern used in UIXDraft templates — gradient text, subheadline, dual CTA, responsive:
/* ── CSS ──────────────────────── */
.hero { padding: 80px 20px; text-align: center; }
.hero h1 {
font-size: clamp(28px, 5vw, 56px);
font-weight: 800; line-height: 1.1;
letter-spacing: -0.02em;
}
.hero h1 span {
background: linear-gradient(135deg, #a78bfa, #38bdf8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.hero-btns { display: flex; gap: 12px; justify-content: center;
flex-wrap: wrap; margin-top: 28px; }
.btn-primary { background: #7c3aed; color: #fff;
padding: 14px 28px; border-radius: 10px; font-weight: 700; }
.btn-secondary { border: 1px solid rgba(255,255,255,.2);
color: #fff; padding: 14px 28px; border-radius: 10px; }
Frequently Asked Questions
How do I create a hero section in HTML and CSS?
Minimal hero: `.hero { padding: 80px 20px; text-align: center; }`. Gradient headline text: `background: linear-gradient(135deg, #a78bfa, #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent`. Responsive font: `font-size: clamp(28px, 5vw, 56px)`. Dual CTA buttons in a flex row with gap. See the full code block above.
What makes a good HTML hero section?
A good hero section: passes the 3-second blink test (clear value proposition), has one primary CTA and one secondary CTA, shows social proof immediately below (logo strip or user count), uses responsive typography with clamp(), and loads in under 1 second. The headline does the job — avoid carousels, excessive animations, or multiple competing messages.
How do I make gradient text in HTML?
CSS gradient text: `background: linear-gradient(135deg, #a78bfa, #38bdf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;`. Apply this to a `span` within your h1, not the entire heading, so non-gradient text remains legible. Works in all modern browsers.
How do I make a full-screen hero section?
Full viewport hero: `.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; }`. For a background image: add `background: url('hero.jpg') center/cover no-repeat;` and a dark overlay with `::before { content:''; position:absolute; inset:0; background:rgba(0,0,0,.5); }`. Always compress the hero image to under 200KB WebP.
What is the best hero section for a SaaS website?
Best-converting SaaS hero: centered layout (not split), specific benefit headline ('Reduce support tickets by 40%' not 'The platform for support teams'), primary CTA ('Start free trial — no credit card') and secondary ('See a demo'), stat bar below ('Trusted by 5,000+ teams · 4.9/5 on G2 · 99.9% uptime'), and product screenshot below the fold. Avoid hero animations that delay time-to-first-interaction.