CSS Data Type
Description
The <gradient> CSS data type represents a smooth transition between two or more colors, which can be applied to backgrounds, borders, or other visual elements to create visually appealing effects. Unlike a simple color value, a <gradient> allows for multiple color stops along a gradient line or shape, enabling complex color transitions. Gradients are considered images in CSS, which means they can be used wherever an background-image is accepted.
There are several types of <gradient>, each designed for specific visual effects. Linear gradients create color transitions along a straight line, while radial gradients radiate colors from a central point outward. Conic gradients rotate colors around a center like a pie chart. Using <gradient> can enhance UI design, for instance in buttons, headers, or canvas elements, providing depth and visual interest without relying on external images.
Gradients can include transparency, using rgba() or hsla() color values, which allows layering effects and blending with other backgrounds. Multiple color stops allow precise control over where one color ends and another begins. For example, you can make smooth transitions between two shades of blue or create a rainbow effect with multiple colors. This makes <gradient> a powerful tool in modern web design for dynamic, responsive, and scalable color effects.
Example: Linear Gradient
button {
background: linear-gradient(90deg, #ff7e5f, #feb47b);
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
}
Example: Radial Gradient
div {
background: radial-gradient(circle, #89f7fe, #66a6ff);
width: 200px;
height: 200px;
}
Example: Conic Gradient
section {
background: conic-gradient(#ff0000, #00ff00, #0000ff, #ff0000);
width: 200px;
height: 200px;
border-radius: 50%;
}
Using <gradient> in CSS allows for rich, high-performance visual effects directly in code, reducing the need for external images and improving both maintainability and performance.
Syntax
<gradient> = <linear-gradient()> | <repeating-linear-gradient()> | <radial-gradient()> | <repeating-radial-gradient()>
Values
- <linear-gradient()>Please go to linear-gradient() function to view values.
- <repeating-linear-gradient()>Please go to repeating-linear-gradient() function to view values.
- <radial-gradient()>Please go to radial-gradient() function to view values.
- <repeating-radial-gradient()>Please go to repeating-radial-gradient() function to view values.
Example
Browser Support
The following information will show you the current browser support for the CSS gradient data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 2nd January 2026
