Is there a css way to show a cursor in a transparent input? I keep googling and all that pops up is how to hide it!
<input class='transparent' />
.transparent{
color:transparent;
background:transparent;
}
To be absolutely clear the only thing I want to show up in the input is the cursor, nothing else - i.e. the text should be hidden but the cursor should still be visible.
To hide blinking cursor in input text with CSS, we set the caret-color property. to set the caret-color to transparent to make the blinking cursor disappear from the input.
Approach: First, select the element where cursor element need to hide. Add CSS style cursor:none to the a class. Add the class name (class name of CSS style cursor:none) to the particular element where cursor element to be hide.
A caret (sometimes called a "text cursor") is an indicator displayed on the screen to indicate where text input will be inserted. Most user interfaces represent the caret using a thin vertical line or a character-sized box that flashes, but this can vary. This point in the text is called the insertion point.
You could style the text not touching the caret using the text-fill-color
feature of webkit.
.transparent{
background:transparent;
color:black; /* sets the color of both caret and text */
-webkit-text-fill-color: transparent; /* sets just the text color */
}
<input class='transparent' />
The feature isn't supported by all the browsers, but the recent versions of the most widely-used browsers do support it.
I managed to solve this using the caret-color
CSS property in input, text areas and content-editable divs:
https://css-tricks.com/almanac/properties/c/caret-color/
input,
textarea,
[contenteditable] {
caret-color: red;
}
Keep the color property as transparent
for the text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With