CSS:渐变文本颜色?

编程入门 行业动态 更新时间:2024-10-09 22:24:00
本文介绍了CSS:渐变文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图得到一些文本有渐变色,但我没有一个线索如何。我想这样得到:

I'm trying to get some text to have a gradient colour, but I haven't a clue how. I'm trying to get it like this:

我尝试的唯一的事情是 -webkit-mask ,但我不能得到工作如何我想要它。另一件事是 -webkit-gradient 在颜色属性 - 是可能吗?

The only thing I have tried is -webkit-mask, but I couldn't get that working how I wanted it to. The other thing would be -webkit-gradient in the color property - is that possible?

跨浏览器兼容性相当重要,但不是世界末日。我宁愿文本在IE中是一个纯色,而不是将整个东西转换成一个图像(有相当多的文本,像这样,其中一些是动态的)。

Cross browser compatibility is fairly important, but not the end of the world. I'd prefer the text to be a solid colour in IE than to convert the entire thing into an image (there is quite a bit of text like this, some of it dynamic).

推荐答案

对于基于webkit的浏览器(Chrome和Safari):

For webkit based browsers (Chrome & Safari) :

.text { font-size: 20px; background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#111)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

其他:

http:/ /www.webdesignerwall/demo/css-gradient-text/

更多推荐

CSS:渐变文本颜色?

本文发布于:2023-11-30 22:37:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651678.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文本   颜色   CSS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!