How do I make a gradient background in CSS?
Use the background or background-image property with a gradient function, for example background: linear-gradient(90deg, #ff7a18, #af002d). Gradients are treated as images, so they cannot be used with the background-color property. Placing a plain background-color declaration first gives you a solid color if the gradient is not applied.
What is the difference between linear, radial and conic gradients?
A linear gradient blends colors along a straight line at a set angle. A radial gradient blends outward from a center point in a circle or ellipse, like a spotlight. A conic gradient rotates colors around a center point, like the hands of a clock, which makes it useful for pie charts, color wheels and rings.
What does the angle mean in a CSS linear gradient?
The angle sets the direction the gradient travels toward. 0deg points up, 90deg points right, 180deg points down and 270deg points left, with angles increasing clockwise. If you leave the angle out, CSS uses 180deg, so the gradient runs from top to bottom.
Why should I add a background-color fallback to a gradient?
Browsers ignore any declaration they do not understand and keep the previous valid one, so a background-color line placed before the gradient acts as a safety net. It covers older browsers that lack support for a gradient type such as conic-gradient, and it keeps text readable if the gradient is disabled or fails to render.