Thursday, October 5, 2023
 Popular · Latest · Hot · Upcoming
64
rated 0 times [  67] [ 3]  / answers: 1 / hits: 46054  / 14 Years ago, mon, august 3, 2009, 12:00:00

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.


More From » html

 Answers
24

You can use the CSS pseudo class selector ::selection and ::-moz-selection for Firefox.



For example:



::-moz-selection {
background-color: transparent;
color: #000;
}

::selection {
background-color: transparent;
color: #000;
}

.myclass::-moz-selection,
.myclass::selection { ... }

[#99002] Thursday, July 30, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shamya

Total Points: 38
Total Questions: 101
Total Answers: 96

Location: Thailand
Member since Thu, Apr 22, 2021
3 Years ago
;