Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize text Color gradient by css3

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how css3 implements text color gradients. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The first method of css3 text color gradient is to realize the dynamic color gradient of css text through the animation attributes of css3.

Text color gradient

H3 {

Height:60px

Color:#f35626

Background:coral

Background-image:-webkit-linear-gradient (45degpence.f35626pr. Feab3a)

-webkit-background-clip:text

-webkit-text-fill-color:transparent

-webkit-animation:hue6sinfinitelinear

}

@-webkit-keyframeshue {

From {

-webkit-filter:hue-rotate (0deg)

}

To {

-webkit-filter:hue-rotate (- 360deg)

}

}

The second method of css3 text color gradient is to realize the static effect of text color gradient through mask-image attribute.

Text color gradient

. text-gradient {

Display:inline-block

Font-family:' Microsoft Yahei'

Font-size:5em

Position:relative

}

. text-gradient [data-text]:: after {

Content:attr (data-text)

Color:green

Position:absolute

Left:0

Z-index:2

-webkit-mask-image:-webkit-gradient (linear,00,0bottom,from (# ff0000), to (rgba))

}

As can be seen from the CSS code, the implementation of the effect, in addition to "content content generation technology", mainly uses the mask-image attribute.

The third method of css3 text color gradient is to achieve the static effect of text color gradient through the background-clip+text-fill-color attribute.

Text color gradient effect

. text-gradient {

Display:inline-block

Color:green

Font-size:5em

Font-family:' Microsoft Yahei'

Background-image:-webkit-gradient (linear,00,0bottom,from (rgba), to (rgba))

-webkit-background-clip:text

-webkit-text-fill-color:transparent

}

Thank you for reading! On "css3 how to achieve text color gradient" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report