文字输入的CSS渐变

时间:2018-08-05 08:18:05

标签: html css

是否可以使<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;
}

1 个答案:

答案 0 :(得分:-1)

是的,请尝试这个

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)
);