Html 如何在不更改文本颜色的情况下更改光标颜色?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5615681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change cursor color without changing text color?
提问by AndrewFerrara
I want to have the cursor #FFF
while my font is #000
.
我想#FFF
在我的字体是#000
.
Is that possible?
那可能吗?
回答by alex
回答by SpliFF
Yes it's easy. Set your font color normally then use a custom cursor.
是的,这很容易。正常设置字体颜色,然后使用自定义光标。
http://beradrian.wordpress.com/2008/01/08/cross-browser-custom-css-cursors/
http://beradrian.wordpress.com/2008/01/08/cross-browser-custom-css-cursors/
That does depend on wether the custom cursor can be color, I'm just assuming it can be.
这取决于自定义光标是否可以是颜色,我只是假设它可以。
回答by Dev Bhaskar
to change caret color CSSof input type text and textarea use below css
要改变插入颜色CSS输入类型的文本和下面的css textarea的使用
input,textarea {
color: #8f0407;
text-shadow: 0px 0px 0px #000 ;
-webkit-text-fill-color: transparent ;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: #ccc;
text-shadow: none;
-webkit-text-fill-color: initial;
}
回答by Matthew Harrison
回答by Balvant Ahir
Try this
尝试这个
<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>