Detailed explanation of how to use lineaer-gradient in CSS3

Y2J
Release: 2017-05-19 15:10:20
Original
2483 people have browsed it

Grammar:

= linear-gradient([ [ | to ] ,]? top>[, ]+)

= [ left| right] | | [top | bottom]

= [ | ]?

Value:

The following values are used to represent the direction of the gradient, which can be set using angles or keywords:

:

Use the angle value to specify the direction of the gradient ( or angle).

to left:

Set the gradient from right to left. Equivalent to: 270deg

to right:

sets the gradient from left to right. Equivalent to: 90deg

to top:

Set the gradient from bottom to top. Equivalent to: 0deg

to bottom:

sets the gradient from top to bottom. Equivalent to: 180deg. This is the default value, which is equivalent to leaving it blank.

is used to specify the starting and ending colors of the gradient:

:

Specifies the color.

:

Specify the starting and ending color positions with the length value. Negative values are not allowed

:

Specify the starting and ending color positions in percentage.

Instructions:

Create an image with a linear gradient.

If you want to create an image with a diagonal gradient, you can use a multi-keyword method like to top left to achieve it.

Draw the simplest linear gradient with the default gradient direction

Sample code:

linear-gradient(#fff, #333); linear-gradient(to bottom, #fff, #333); linear-gradient(to top, #333, #fff); linear-gradient(180deg, #fff, #333); linear-gradient(to bottom, #fff 0%, #333 100%);
Copy after login

Compatibility:

Detailed explanation of how to use lineaer-gradient in CSS3

1. Use outdated syntax: -webkit-gradient(linear,…)

2. IE6.0-9.0 uses a private filter to achieve this effect: progid:DXImageTransform.Microsoft.Gradient()

    linear-gradient()_CSS参考手册_web前端开发参考手册系列   
  

Copy after login

【Related Recommendations】

1.CSS3 Free Video Tutorial

2.In-depth explanation of CSS3 Medium oblique linear gradient lineaer-gradient

3.Detailed explanation of the linear-gradient parameter in CSS3

4.CSS linear-gradient( ) syntax detailed explanation

5.Detailed explanation of linear-gradient examples in CSS3

The above is the detailed content of Detailed explanation of how to use lineaer-gradient in CSS3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!