Implementation of gradient text in css3

Source: Internet
Author: User

Implementation in background-clip + Text-fill-color

If your browser is chrome or Safari, you can see the following effects on the demo page:

 
<H2Class= "Text-gradient">Tianci meiniu</H2>

CSS (CSSCodeIs actually the last three lines ):

 . Text-Gradient  {  
Display : Inline-block ;
Color : Green ;
Font-size : 10em ;
Ont-family : '' ;
Background-Image : -WebKit-gradient (linear, 0 0, 0 bottom, from (rgba (0,128, 0, 1), to (rgba (51, 51, 51, 1 ))) ;
-WebKit-Background-clip : Text ;
-WebKit-text-fill-color : Transparent ;
} ;

Conclusion
Currently, the text-fill-color attribute seems to be supported by the WebKit core browser, so the gradient effect can only be seen on the two demo pages in chrome or safari. Solid color in Firefox, not to mention in IE.

However, the text gradient itself is a decorative function. Therefore, based on the progressive enhancement principle, we can use it boldly in actual projects. Just a few lines of CSS code without affecting the original functions, so that Chrome browsers with higher shares have a better visual experience. Why not?

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.