CSS3 gradient background effect for compatibility

Source: Internet
Author: User

First, CSS3 achieve compatibility gradient background effect, compatible with FF, Chrome, IE

Gradient effect, now the main browser ff, Chrome, Opera, ie8+ can be used with the private prefix CSS3 properties to easily drop the gradient effect, IE7 and the following can also be filtered through the filter to achieve the gradient effect (filter to achieve the use of a lot of resources)

? why filter to achieve gradient effect will consume a lot of resources Oh, rookie, what do not understand, will only Baidu. It's laughed at.

The reason is: because the internal IE in the resolution filter , but also through a large number of CPU calculation , so as to achieve the filter effect , and finally render.

Second, how to achieve the gradient effect of the browser

1, CSS3 to achieve the standard wording of the gradient background

Background:linear-gradient ([<angle> | <side-or-corner>,] <color-stop> [, <color-stop>]+);

    • []Represents a character class in the regular, and here you can understand it as a small unit.
    • |Represents a candidate. That means "or", either in front or on the back.
    • ?As a quantifier, the expression of 0 one or 1 the other, the implication is that you can not specify the direction, directly fade away.

Side-or-corner
side-or-cornerChinese means "Edge or corner", the optional values are:

[left | right] | | [Top | bottom]

Color-stop
Gradient key Color node, syntax:
<color> [<percentage> | <length>]

Gecko Kernel Browser:
Background:-moz-linear-gradient (Top, #CCC, #333);
WebKit Kernel Browser:
Background:-webkit-gradient (linear, Top, from (#CCC), to (#333));
IE8 and below are implemented by filters:
Filter:progid:DXImageTransform.Microsoft.gradient (gradienttype=1,startcolorstr= ' #CCC ', endcolorstr= ' #333 '); /*ie Filters for Gradients */
Among them, gradienttype=1 represents the horizontal gradient, gradienttype=0 represents the longitudinal transformation. Startcolorstr= "Color" represents the starting color of the gradient gradient, and endcolorstr= "color" represents the color at the end of the gradient.
ie8+:
background: -ms-linear-gradient(0%,100%);


CSS3 gradient background effect for compatibility

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.