Which of the following CSS Gradient Functions sets the direction and colors of a gradient that fades from one color to the next in a straight line?

gradient()
line-gradient()
linear-gradient()
none of the mentioned

The correct answer is C. linear-gradient().

A linear gradient is a type of gradient that fades from one color to the next in a straight line. The direction of the gradient is specified by the to keyword, which takes a value of left, right, top, or bottom. The colors of the gradient are specified by the from and to keywords, which take color values.

For example, the following CSS code creates a linear gradient that fades from red to blue from left to right:

css
background-image: linear-gradient(to right, red, blue);

The gradient() function is a generic function that can be used to create any type of gradient. However, it is not specifically designed for linear gradients. The line-gradient() function is specifically designed for linear gradients, and it is therefore the preferred way to create them.

The none of the mentioned option is incorrect because it does not include the correct answer.

Exit mobile version