简体   繁体   English

文本输入上的CSS渐变

[英]CSS gradient on text input

Is it possible to make the text color of an <input> a gradient? 是否可以使<input>的文本颜色成为渐变? I found this solution for static text but it does not work for input: 我找到了静态文本的解决方案,但它不适用于输入:

h1 {
  font-size: 72px;
  background: -webkit-linear-gradient(to right, rgb(66, 251, 227), rgb(43, 43, 
  255));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

Yes it is possible please try this 是的,有可能请尝试这个

background-image: linear-gradient(bottom, #f00 5%, #000 100%);
background-image: -o-linear-gradient(bottom, #f00 5%, #000 100%);
background-image: -moz-linear-gradient(bottom, #f00 5%, #000 100%);
background-image: -webkit-linear-gradient(bottom, #f00 5%, #000 100%);
background-image: -ms-linear-gradient(bottom, #f00 5%, #000 100%);
background-image: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.05, #f00),
    color-stop(1, #000)
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM