简体   繁体   中英

hide caret (text cursor) on contenteditable div in internet explorer

I have contenteditable div on which i have file drop and copy-paste image event. By using the color:transparent i am able to hide the blinking cursor on chrome browser. but in IE i came to know "The color of the text cursor in an input on IE is always the inverse of the background color". Source: How do I change the color of the text cursor in an input field in IE?

Is there any alternative way to disable a cursor or change the speed of blinking cursor so it looks like hidden in IE.

You can do it in CSS with:

caret-color: transparent

Doesn't work in IE though. Here is browser support chart .

Assuming you mean changing the caret cursor, otherwise known as the text cursor; there are solutions available, although support for IE is rather limited. Perhaps, if not already, you might find this of some use: Hide textfield blinking cursor

You can do this for IE with this hack:

color: transparent;
text-shadow: 0 0 0 #333333;

You can replace the color ( #333333 ) with whatever text color you need.

Try to use cursor: none

The cursor CSS property specifies the mouse cursor displayed when the mouse pointer is over an element. Source .

Regarding the change of speed of blinking cursor it is not so quick and simple to change, you would need design with JavaScript a new "component" for that, but fortunately they are several tutorial or resource online.

 #test { width: 256px; height: 256px; background-color: red; cursor: none; } 
 <div id="test"></div> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM