Last active
June 7, 2022 12:08
-
-
Save JoeKeikun/72718f5faaf518304024 to your computer and use it in GitHub Desktop.
How to change <input> input cursor color by css (webkit)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I developed an app for ios by phonegap, I had a trouble in changing the <input> input cursor color. | |
but now, there is a solution for it: | |
--------------- | |
<style> | |
input { | |
color: rgb(60, 0, 248); /* change [input cursor color] by this*/ | |
text-shadow: 0px 0px 0px #D60B0B; /* change [input font] by this*/ | |
-webkit-text-fill-color: transparent; | |
} | |
</style> | |
--------------- | |
this will change placeholder's color too. If we also need to change placeholder's color after this, we can use this: | |
--------------- | |
<style> | |
input::-webkit-input-placeholder{ | |
color: rgb(60, 0, 248); /* change [placeholder color] by this*/ | |
text-shadow: none; | |
-webkit-text-fill-color: initial; | |
} | |
</style> | |
--------------- |
Use caret-color instead!
input {
caret-color : rgb(60, 0, 248);
}
Nice code. thanks for the tip.
please let me know how to css use only on iphone caret-color:transparent;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not working in IE T.T