Create beautiful color gradients visually and copy the CSS code instantly - no design experience required.
Linear gradients flow in one direction. Radial gradients expand outward from a center point like a spotlight.
Controls the direction the colors flow - 0deg flows upward, 90deg flows right, 180deg flows downward.
Everything a beginner or seasoned designer needs to know about using CSS gradients effectively.
A linear gradient transitions colors along a straight line - from one side of an element to another, or diagonally. You define an angle (in degrees) that determines the direction: 0deg moves bottom to top, 90deg moves left to right, and 180deg moves top to bottom. This is the most common gradient type used for hero backgrounds, button fills, and card headers because it creates clean, directional visual flow that guides the eye across a layout.
A radial gradient radiates outward from a center point, creating a circular or elliptical glow effect. Radial gradients work beautifully for spotlight effects, hover states, icon backgrounds, and anywhere you want depth or dimensionality. The default shape is an ellipse that fills the element, though you can specify a circle or define a custom position for the focal point.
Color stops are the individual colors that make up your gradient, along with their positions. Every gradient needs at least two stops - a starting color and an ending color. A position of 0% places a stop at the very beginning of the gradient, and 100% places it at the very end. You can add as many intermediate stops as you want. For example, a gradient might go from deep blue at 0%, through purple at 50%, to coral pink at 100%. Stops that are close together create sharp transitions, while stops placed farther apart produce smooth blends. Hard color stops (placing two stops at the same percentage) create crisp dividing lines between colors, which is useful for striped patterns.
background: linear-gradient(...). Then set -webkit-background-clip: text; background-clip: text; to clip the background to the shape of the text characters. Finally, set color: transparent; so the text fill becomes invisible and lets the gradient background show through. The result is vivid, colorful typography with no images required. Always ensure sufficient contrast between your gradient and the page background so the text remains readable for all users, including those with visual impairments.
-webkit-linear-gradient for modern browser support, though adding them causes no harm for legacy compatibility. The code generated by this tool uses the standard unprefixed syntax. The only exception worth noting is Internet Explorer 11, which supports linear gradients but not the full radial gradient spec - if IE11 support is critical for your project, test thoroughly and consider a solid-color fallback.
/* --- Linear Gradient --- */ /* direction color-start color-end */ background: linear-gradient(135deg, #6366f1, #ec4899); /* With a middle stop at 50% */ background: linear-gradient(90deg, #06b6d4 0%, #8b5cf6 50%, #ec4899 100%); /* --- Radial Gradient --- */ /* shape color-center color-edge */ background: radial-gradient(circle, #fbbf24, #ef4444); /* Ellipse with explicit stops */ background: radial-gradient(ellipse at center, #a78bfa 0%, #1e1b4b 100%);
When using gradients as backgrounds for text, accessibility is paramount. The WCAG 2.1 guidelines require a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text against its background. Because gradients shift in color across their span, you should test contrast against both the lightest and darkest regions of your gradient. A practical approach is to place text over a semi-transparent dark overlay (rgba(0,0,0,0.4)) on top of your gradient - this preserves the visual interest of the gradient while guaranteeing text legibility. Never rely on color alone to convey information, and always preview your design on different monitor types (IPS, OLED, and standard TN panels render colors differently).
Disclaimer: This tool generates standard CSS background code. Always test your gradients across different monitors and browsers to ensure optimal color accessibility.