DEV Community

Cover image for How to create colorful text inputs with CSS
David Díaz
David Díaz

Posted on • Originally published at daviddiaz.hashnode.dev

How to create colorful text inputs with CSS

CSS never ceases to amaze me

Every few and then, I check the web design subreddit to check some of the ideas proposed on there, because there are really talented people out there showing their work, and that might inspire you.

But sometimes, you find CSS related stuff that not only it's helpful, but also it blows your mind. What if I tell you that you can change the color of the caret of an input? That's cool right? The only thing we need is this property:

carbon (2).png

The MDN describes the property as the following:

"The caret-color CSS property sets the color of the insertion caret, the visible marker where the next character typed will be inserted. By default, it is black, but its color can be altered with this property."

By using this property, we would get something like this (click on the input to see the effect):

This simple line of CSS can be very helpful, and I'm pretty sure a lot of you can imagine lots of usages for this.

But what if I tell you that we can animate this input even more? With just a little bit more of CSS we can get something as cool as this:

One might think that this is a little bit too much, and that might be right, but sometimes we just wanna have some fun with the styles, and this is one of those times.

The point of this post, appart from showing you this CSS property, is to show how inmense is CSS and how much stuff we can learn and create that we don't even know about yet. Fascinating, right?

Top comments (5)

Collapse
 
hassan_k_a profile image
.

great article thanks a lot.

Collapse
 
dd8888 profile image
David Díaz

Thank you for reading it!

Collapse
 
hassan_k_a profile image
.

you are welcome.

Collapse
 
nazanin_ashrafi profile image
Nazanin Ashrafi

This is so cool 😍🙌🙌

Collapse
 
dd8888 profile image
David Díaz

I know right? CSS is amazing!