Home > Web Front-end > CSS Tutorial > Example of how CSS implements text color gradient

Example of how CSS implements text color gradient

黄舟
Release: 2017-11-01 10:32:01
Original
2818 people have browsed it

Preface

Mainly use three CSS attributes:

  1. linear-gradient() Images used to achieve gradients

  2. background-clip Specifies the background image of the objectarea to be clipped outward

  3. ##text-fill-color Specify the fill color of the text

Example
      background: linear-gradient(to bottom,#fff 0%,#333 100%);
      background-clip: text;
      -webkit-background-clip: text;
      text-fill-color: transparent;
      -webkit-text-fill-color: transparent;
Copy after login

Linear-gradient() can specify the gradient angle and color. In the example, the color transformation is from top to bottom

Background-clip:text has the shape of the text as Cropping area

Text-fill-color:transparent The fill color of the text is transparent

The effect is as follows:

 

  

Compatibility

Both chrome and newer versions of firefox support the background-clip and text-fill-color properties, and the -webkit- prefix is ​​required

IE both The text value of the background-clip attribute is not supported

The above is the detailed content of Example of how CSS implements text color gradient. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template