Home>Article>Web Front-end> css3 color gradient: How to implement background color gradient in css3?

css3 color gradient: How to implement background color gradient in css3?

不言
不言 Original
2018-09-15 13:42:20 13284browse

In order to develop the beauty of web pages, css3 background color gradient is often used. So, how to set css3 background color gradient? In this article, we will introduce how to set the css color gradient background.

What we need to know is that there are two types of css3 gradients:css3 linear gradient and css3 radial gradient. Let’s take a look at the effects of these two css3 gradients to achieve background color gradients. How it is.

1. Background color gradient set by css3 linear gradient

First of all, we need to know that the attribute used by css3 linear gradient is linear-gradient.

Syntax: linear-gradient(to bottom,colorStrat,colorEnd)

Parameter meaning:

The first parameter specifies the direction of the gradient

to bottom From top to bottom; to bottom right from top left to bottom right; to right from left to right; to up right from bottom left to top right;

to up from bottom to bottom; to up left from lower right to upper left; to left from right to left; to bottom left from upper right to lower left

The second parameter specifies the starting color of the gradient

The third parameter specifies the gradient color End color

Example:

    php中文网  

线性渐变 - 从上到下

css3 background color gradient effect is as follows:

css3 color gradient: How to implement background color gradient in css3?

2. Background color gradient set by css3 radial gradient

The radial gradient is defined by its center.

In order to create a radial gradient, you must also define at least two color nodes. Color nodes are the colors you want to show a smooth transition. At the same time, you can also specify the center, shape (circle or oval), and size of the gradient. By default, the center of the gradient is center (representing the center point), the shape of the gradient is ellipse (representing an ellipse), and the size of the gradient is farthest-corner (representing the farthest corner).

The attribute used by css3 radial gradient is radial-gradient.

Syntax: background: radial-gradient(shape size at position, start-color, ..., last-color);

Example:

    php中文网  

径向渐变

css3 background color gradient effect is as follows:

css3 color gradient: How to implement background color gradient in css3?

##This article ends here, about css3 linearity in css3 gradient For more information on gradients and css3 radial gradients, please refer to

css3 Manual.


The above is the detailed content of css3 color gradient: How to implement background color gradient in css3?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn