You need a gradient background for your hero section — not a 45-minute design session. Here are 10 ready-to-use gradient backgrounds with copy-paste CSS, plus how to build your own in seconds.
| Name | Colors | CSS Code |
|---|---|---|
| Dark Purple Hero | #667eea → #764ba2 | linear-gradient(135deg, #667eea 0%, #764ba2 100%) |
| Sunset CTA | #f093fb → #f5576c | linear-gradient(135deg, #f093fb 0%, #f5576c 100%) |
| Subtle Gray Card | #2c3e50 → #3498db | linear-gradient(180deg, #2c3e50 0%, #3498db 100%) |
| Neon Gaming | #00f260 → #0575e6 | linear-gradient(90deg, #00f260 0%, #0575e6 100%) |
| Soft Pastel | #a8edea → #fed6e3 | linear-gradient(135deg, #a8edea 0%, #fed6e3 100%) |
| Ocean Blue | #2193b0 → #6dd5ed | linear-gradient(to right, #2193b0, #6dd5ed) |
| Warm Amber | #f7971e → #ffd200 | linear-gradient(to right, #f7971e, #ffd200) |
| Cool Mint | #00b09b → #96c93d | linear-gradient(to right, #00b09b, #96c93d) |
| Dark Mode | #0d1117 → #161b22 | linear-gradient(180deg, #0d1117 0%, #161b22 100%) |
| Rainbow Pride | #f5576c → #f093fb → #667eea → #4facfe | linear-gradient(90deg, #f5576c, #f093fb, #667eea, #4facfe) |
Copy any CSS value above and paste it as a background property. Or open the CSS Gradient Generator to customize colors, angle, and stops visually.
Set the gradient on the body element with min-height: 100vh so it covers the entire viewport:
body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; }background-attachment: fixed if you want the gradient to stay fixed while content scrollsApply to any container element. Hero sections with gradient backgrounds load faster than hero images:
.hero { background: linear-gradient(to right, #f093fb, #f5576c); padding: 80px 20px; }Subtle gradients add depth to cards without competing with content:
.card { background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%); border-radius: 12px; padding: 24px; }Gradient buttons stand out from flat-colored buttons:
.btn { background: linear-gradient(90deg, #f093fb, #f5576c); border: none; color: #fff; padding: 12px 24px; border-radius: 6px; }background-position or darken the colorsTransparent gradients are essential for text overlays on images:
| Use Case | CSS Code | Effect |
|---|---|---|
| Image text overlay | linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%) | Dark bottom fade for readable text |
| Frosted top bar | linear-gradient(to bottom, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%) | Light header that fades into content |
| Side fade | linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%) | Left-side dark area for sidebar text |
| Vignette effect | radial-gradient(circle, rgba(0,0,0,0) 50%, rgba(0,0,0,0.5) 100%) | Subtle darkening at edges |
| Metric | CSS Gradient | Background Image |
|---|---|---|
| File size | 0 KB (pure CSS) | 50-500 KB typical |
| Network requests | 0 | 1 (plus DNS/TLS if CDN) |
| Render speed | Instant | Depends on download speed |
| Resolution | Infinite (vector) | Fixed (pixelated if scaled) |
| Responsive | Auto-scales to any size | Needs srcset or media queries |
| Editable | Change one line of CSS | Re-export from design tool |
| SEO impact | None — no CLS shift | Can cause layout shift if not sized |
Every gradient background on your site is one fewer image to download. On mobile connections, this difference compounds across every page load.
Build gradient backgrounds visually — pick colors, copy CSS, paste into your project.
Open Gradient Generator