Skip to content
GENERATORS

CSS Gradient Generator – linear-gradient

Generate a CSS linear-gradient background.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

CSS Gradient Generator

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

  1. Type an angle or direction, then two or more HEX colours, separated by spaces.
  2. Click Run Tool to generate the CSS.
  3. 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.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.