What are the ways to realize the color gradient of css text
This article mainly shows you the "css text color gradient of what are the ways to achieve", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn about the "css text color gradient of what are the ways to achieve" this article.
Base style:
. gradient-text {text-align:left;text-indent:30px;line-height:50px;font-size:40px;font-weight:bolder;position:relative;}
The first method is to use background-cli, text-fill-color:
.clients-text-one {
Background-image:-webkit-linear-gradient (bottom,red,#fd8403,yellow)
-webkit-background-clip:text
-webkit-text-fill-color:transparent
}
Description:
Background:-webkit-linear-gradient (...) Provides a gradient background for text elements.
Webkit-text-fill-color:transparent fills the text with transparent colors.
Webkit-background-clip:text clips the background with the text and fills the text with the gradient background as the color.
The second method is to use mask-image:
.clients-text-two {
Color:red
}
Data-content-text-two [data-content]:: after {
Content:attr (data-content)
Display:block
Position:absolute
Color:yellow
Left:0
Top:0
Z-index:2
-webkit-mask-image:-webkit-gradient (linear,00,0bottom,from (yellow), to (rgba))
}
Description:
Mask-image, like background-image, can be not only a picture path, but also a gradient.
The third method, use linearGradient, fill:
.clients-text-three {
Fill:url (# SVGID_1_)
Font-size:40px
Font-weight:bolder
}
the time when spring breezes bring the news of the flowers
Description:
There are two main types of gradients in SVG:
Linear gradient (linearGradient)
Radioactive gradient (radialGradient)
Gradients in SVG can be used to fill not only graphic elements, but also text elements.
Dom example:
CSS3 gradient font
* {margin:0;padding:0;}
Body,html {width:100%;height:100%;}
.wrapper {width:80%;margin:0auto;margin-top:30px;}
. gradient-text {text-align:left;text-indent:30px;line-height:50px;font-size:40px;font-weight:bolder;position:relative;}
.clients-text-one {
Background-image:-webkit-linear-gradient (bottom,red,#fd8403,yellow)
-webkit-background-clip:text
-webkit-text-fill-color:transparent
}
.clients-text-two {
Color:red
}
Data-content-text-two [data-content]:: after {
Content:attr (data-content)
Display:block
Position:absolute
Color:yellow
Left:0
Top:0
Z-index:2
-webkit-mask-image:-webkit-gradient (linear,00,0bottom,from (yellow), to (rgba))
}
.clients-text-three {
Fill:url (# SVGID_1_)
Font-size:40px
Font-weight:bolder
}
Method 1.background-clip+text-fill-color
In the mood for love
Method 2.mask-image
In one's early teens
Method 3.svglinearGradient
the time when spring breezes bring the news of the flowers
The above is all the contents of this article entitled "what are the ways to realize the color gradient of css text?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!