Home > Blockchain >  Is it possible to change the caret-color of a textarea to *two* colors?
Is it possible to change the caret-color of a textarea to *two* colors?

Time:04-07

I did some research and found you can change the caret-color of a textarea/input to any color you'd like, but is it possible to change it into 2 different colors?

I tried using the CSS linear-gradient function, but that doesn't seem to work:

textarea {
      caret-color: linear-gradient(rgb(0, 255, 0), rgb(0, 0, 0));
}
<textarea></textarea>

whereas solid colors work

textarea {
      caret-color: red;
}
<textarea></textarea>

CodePudding user response:

According to MDN, only possible values for vanilla CSS-based caret-color are colors represented as RGB, RGBA, HSL, HSLA or HWB values or name colors, e.g. black. Gradients are not allowed by specifications.

  • Related