如何禁用html或JS中的高亮显示? [英] How can I disable highlighting in html or JS?
本文介绍了如何禁用html或JS中的高亮显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的网络应用程序上禁用突出显示的所选文字。我有一个很好的理由这样做,知道这通常是一个坏主意。但我需要做它反正。没关系,如果我需要使用CSS或JS来做到这一点。
I need to disable the highlighting of selected text on my web app. I have a good reason for doing this and know that this is generally a bad idea. But I need to do it anyway. It doesn't matter if I need to use CSS or JS to do it. What I'm mainly going for is the removal of the blue color given to highlighted elements.
推荐答案
U可以使用css伪指令类选择器(::选择和:: - moz选择为firefox)。
示例
U can use the css pseudo class selector (::selection and ::-moz-selection for firefox). Example
::-moz-selection{
background-color:Transparent;
color:#000;
}
::selection {
background-color:Transparent;
color:#000;
}
.myclass::-moz-selection,
.myclass::selection { ... }
这篇关于如何禁用html或JS中的高亮显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文