CSS lineargradient() Function (original) (raw)

CSS linear-gradient() Function

Last Updated : 30 Aug, 2024

The linear-gradient() function is an inbuilt function in CSS that is used to set the linear gradient as the background image.

**Syntax:

background-image: linear-gradient( direction, color1, color2, ... )

**Parameters: This function accepts one direction parameter and many color parameters which are listed below:

The below examples illustrate the linear-gradient() function in CSS:

**Example 1: In this example, The .gradient element applies a linear gradient background from green to yellow to blue, with centered text on top.

html `

linear-gradient function