About CSS Gradient Generator
A CSS gradient is a smooth transition between two or more colours, written with the linear-gradient() function and used as a background. This generator turns a short description into the full declaration, with a plain background colour as a fallback.
Type an optional direction, either an angle such as 135deg or a keyword such as to right, followed by colours separated by spaces. Colours are spread evenly along the gradient. Use HEX colour codes, because spaces inside rgb() values would split the colour.
How to use CSS Gradient Generator
- Type an angle or direction, then two or more HEX colours, separated by spaces.
- Click Run Tool to generate the CSS.
- Copy it into your stylesheet, a Customizer field or an Elementor custom CSS box.
Example
Input
135deg #1cb098 #021e40
Output
background: #1cb098; background: linear-gradient(135deg, #1cb098 0%, #021e40 100%);
Common uses
- Creating a background for a hero section, button or card.
- Matching a gradient to your brand colours.
- Learning how angles and colour stops change a gradient.
Privacy and safety
This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.
Frequently asked questions
What does 135deg mean?
It is the angle of the gradient line. 90deg goes left to right, 180deg goes top to bottom and 135deg runs diagonally from the top left to the bottom right.
How many colours can I use?
As many as you like. Each colour gets an equal share of the gradient, for example 0%, 50% and 100% for three colours.
Why is there a plain background line too?
Older browsers that do not understand gradients use the first colour as a fallback.