Html 如何在不更改文本颜色的情况下更改光标颜色?
我想让光标Html 如何在不更改文本颜色的情况下更改光标颜色?,html,css,Html,Css,我想让光标#FFF,而我的字体是#000 有可能吗? 是的,很简单。正常设置字体颜色,然后使用自定义光标 这取决于自定义光标是否可以是彩色的,我只是假设它可以是彩色的。试试这个 <style> input { color: rgb(60, 0, 248); /* change [input cursor color] by this*/ text-shadow: 0px 0px 0px #D60B0B; /* change [input font] by this*/
#FFF
,而我的字体是#000
有可能吗?
是的,很简单。正常设置字体颜色,然后使用自定义光标
这取决于自定义光标是否可以是彩色的,我只是假设它可以是彩色的。试试这个
<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>
输入{
颜色:rgb(60,0,248);/*通过以下方式更改[输入光标颜色]*/
文本阴影:0px 0px 0px#D60B0B;/*通过此选项更改[input font]*/
-webkit文本填充颜色:透明;
}
在css下面使用输入类型文本和文本区域
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;
}
来自mozilla
/*关键字值*/
插入符号颜色:自动;
插入符号颜色:透明;
插入符号颜色:currentColor;
/*价值观*/
插入符号颜色:红色;
插入符号颜色:#5729e9;
插入符号颜色:rgb(0,200,0);
插入符号颜色:hsla(228,4%,24%,0.8);
光标通常为白色。你确定你指的是“光标”吗?你指的是文本框中的插入符号吗?答案很好。它在铬合金中工作良好。但它在internet explorer中不起作用
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;
}
/* Keyword values */
caret-color: auto;
caret-color: transparent;
caret-color: currentColor;
/* <color> values */
caret-color: red;
caret-color: #5729e9;
caret-color: rgb(0, 200, 0);
caret-color: hsla(228, 4%, 24%, 0.8);