Blue to Purple Gradient — CSS, Hex and Angles
The default SaaS hero: cool enough for a dashboard, saturated enough to hold a white headline. The pair is #2563EB → #7C3AED, and on a 135° axis it reads as a diagonal wash. Everything below is generated from those two values, so the CSS you copy is exactly what the previews render.
Copy the CSS
.gradient {
background: #2563EB; /* fallback for old browsers */
background: -webkit-linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
background: -moz-linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
}const gradientStyle = {
background: '#2563EB', // fallback
backgroundImage: 'linear-gradient(135deg, #2563EB 0%, #7C3AED 100%)',
};The two endpoints
| Name | Hex | RGB | HSL | vs white | vs black | |
|---|---|---|---|---|---|---|
| Blue | #2563EB | rgb(37, 99, 235) | hsl(221, 83%, 53%) | 5.17:1 | 4.06:1 | |
| Purple | #7C3AED | rgb(124, 58, 237) | hsl(262, 83%, 58%) | 5.70:1 | 3.69:1 |
The midpoint is #514fec (rgb(81, 79, 236), saturation 81%). Close to the 83% the two ends average, so the transition stays saturated throughout.
What each angle does
| Angle | Direction | Function value |
|---|---|---|
| 0° | bottom → top | linear-gradient(0deg, #2563EB 0%, #7C3AED 100%) |
| 45° | bottom-left → top-right | linear-gradient(45deg, #2563EB 0%, #7C3AED 100%) |
| 90° | left → right | linear-gradient(90deg, #2563EB 0%, #7C3AED 100%) |
| 135° | top-left → bottom-right | linear-gradient(135deg, #2563EB 0%, #7C3AED 100%) |
| 180° | top → bottom | linear-gradient(180deg, #2563EB 0%, #7C3AED 100%) |
| 225° | top-right → bottom-left | linear-gradient(225deg, #2563EB 0%, #7C3AED 100%) |
| 270° | right → left | linear-gradient(270deg, #2563EB 0%, #7C3AED 100%) |
| 315° | bottom-right → top-left | linear-gradient(315deg, #2563EB 0%, #7C3AED 100%) |
The same pair as linear, radial and conic
| Type | Function value |
|---|---|
| linear | linear-gradient(135deg, #2563EB 0%, #7C3AED 100%) |
| radial | radial-gradient(circle at 50% 50%, #2563EB 0%, #7C3AED 100%) |
| conic | conic-gradient(from 0deg at 50% 50%, #2563EB 0%, #7C3AED 100%) |
Frequently asked
What is the CSS for a blue to purple gradient?background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%); — #2563EB at 0% and #7C3AED at 100%, on a 135° axis. Swap 135deg for to right if you want the direction to follow the element ratio instead of a fixed angle.
Does it need vendor prefixes?
Not for current browsers. Unprefixed linear-gradient has been supported everywhere for years, and the -webkit- / -moz- lines only matter for stacks that still ship to browsers older than 2013. The generator emits both, plus a solid #2563EB fallback.
Why would the middle look muddy?
This pair does not: both ends are close enough in hue that a straight sRGB blend stays clean, with mid #514fec holding 81% saturation against 83% at the ends.
Can I put text straight onto it?
Check both ends, not the average. White text clears 4.5:1 against the blue end and black text clears it against neither end. Measured ratios: Blue is 5.17:1 on white and 4.06:1 on black; Purple is 5.70:1 on white and 3.69:1 on black.