仅使用 css 和/或 JQuery,在输入字段中,第一个“x”字符是一种颜色而另一个是另一种颜色是可能的吗?
最佳答案
您可以使用渐变颜色来做到这一点,但它不适用于所有浏览器。 例如,使用 chrome 特定的 css。
<input type="Text" Value="Testing colors" class="textbox" />
input {
font-size: 2em;
background: linear-gradient(to right, red 10%, blue 10%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
关于javascript - 多色输入框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23238647/