简体   繁体   English

CSS更改焦点矩形的颜色(位置焦点)

[英]CSS Change Color Of Focus Rectangle (Location Focus)

I have a textarea with transparent text. 我有一个透明文本的文本区域。 I need it to be transparent to work around a problem I'm having with Highlight.js. 我需要它是透明的,以解决Highlight.js遇到的问题。

It works fine, but there is a problem though. 它工作正常,但是有一个问题。 The user doesn't know where he is in the textarea. 用户不知道他在文本区域中的位置。 I need the focus rectangle (that's what it's called in the Windows UI apparently) to have specific properties. 我需要焦点矩形(显然是Windows UI中所谓的焦点矩形)具有特定的属性。 In this case it must be white and flickering. 在这种情况下,它必须是白色且闪烁。 The rest of the text should stay transparent. 其余文字应保持透明。

textarea {
  color: transparent;
  z-index: 1;
}

Like that, but with a white focus rectangle. 那样,但是有一个白色的焦点矩形。

EDIT: 编辑:

People seem to misunderstand me. 人们似乎误解了我。 I don't want to edit the cursor. 我不想编辑光标。 I want the edit the vertical flickering dash that indicated where you're editing in the textarea. 我要编辑垂直闪烁的短划线,以指示您在文本区域中的编辑位置。

EDIT2: 编辑2:

It's called a caret apparently. 显然,它称为插入符号。

Hey You can refer the following Blog for your requiremenr : 嘿,您可以参考以下Blog作为您的requiremenr:

https://beradrian.wordpress.com/2008/01/08/cross-browser-custom-css-cursors/ https://beradrian.wordpress.com/2008/01/08/cross-browser-custom-css-cursors/

Let me know if is it helpfull to you. 让我知道是否对您有帮助。

code: 码:

input, textarea {
    cursor: url(cursor.cur);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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