在HTML文本输入中选择文本时更改突出显示颜色 [英] Changing the highlight color when selecting text in an HTML text input

查看:1038
本文介绍了在HTML文本输入中选择文本时更改突出显示颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在网上找这个,甚至找不到任何人甚至问这个,更不用说一个解决方案...

I've been looking for this throughout the web and can't even find anyone else even asking this, let alone a solution...

当文本被选择时,在文本输入中改变高亮区域的颜色的方法?

Is there a way to change the color of the highlight area within a text input when text is selected? Not the highlight border or the background, but the portion that appears around the text when you have the text actually selected.

推荐答案

感谢您的支持,感谢您的支持!对于链接,但它看起来好像实际文本突出显示只是不暴露。

Thanks for the links, but it does seem as if the actual text highlighting just isn't exposed.

对于手头的实际问题,我最终选择了不同的方法,通过消除对一个文本输入的需要和使用innerHTML与一些JavaScript。

As far as the actual issue at hand, I ended up opting for a different approach by eliminating the need for a text input altogether and using innerHTML with some JavaScript. Not only does it get around the text highlighting, it actually looks much cleaner.

这种粒度对HTML表单控件的调整只是消除表单控件的另一个好的参数共。哈哈!

This granular of a tweak to an HTML form control is just another good argument for eliminating form controls altogether. Haha!

这篇关于在HTML文本输入中选择文本时更改突出显示颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆