CSS3文字渐变不起作用? [英] CSS3 Text Gradients not working?
本文介绍了CSS3文字渐变不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在某些文本上应用纯CSS3渐变(无图像等),但文本保持不变。
I am trying to apply pure CSS3 Gradients (no images, etc.) on some text but the text remains un-changed.
我当前的代码是:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Text Gradients</title>
<style>
/* The gradient class */
.gradient {
-webkit-mask-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(252,255,244,1)), color-stop(100%,rgba(233,233,206,1)));
}
</style>
</head>
<body>
<!--The text with the gradient-->
<h1 class="gradient"> Hello World </h1>
</body>
</html>
推荐答案
我能够使用以下方法在Chrome中生成渐变文本:
I was able to produce gradient text in Chrome using:
h1 {
font-size: 72px;
background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#333));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
这篇关于CSS3文字渐变不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文