i have some divs, when i double click on the any of the div there is blue background selection
are shown, i donot want this blue selection background , this looks weired.. any help to remove this seletion background...
in the image there is grey background
Asked
Active
Viewed 3,475 times
1

Jot Dhaliwal
- 1,470
- 4
- 26
- 47
-
Where is your code, have you missed it? – Praveen Jan 01 '14 at 09:00
-
You'll kind of ruin the user's expected behavior if you do this. If they want to select something, they wouldn't know if it worked properly. – casraf Jan 01 '14 at 09:01
-
simply double click on my question's any word.. you can see the selection blue background... – Jot Dhaliwal Jan 01 '14 at 09:02
-
You want different color for selection? – Bindiya Patoliya Jan 01 '14 at 09:10
-
1possible duplicate of [CSS rule to disable text selection highlighting](http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting) – kleinfreund Jan 01 '14 at 09:20
2 Answers
2
You can make use of user-select
(-prefix-)user-select: none;
The text of the element and sub-elements will not be able to be selected.

Praveen
- 55,303
- 33
- 133
- 164
-
this provided to the specific div which shows the blue background – Jot Dhaliwal Jan 01 '14 at 09:06
-
1@Jat.net this is disable the double click in the div so there will be no blue color. Incas if you want to change the color then you can use `(-webkit-)-tap-highlight-color` works only in chrome and safari – Praveen Jan 01 '14 at 09:08
2
check out this fiddle
http://jsfiddle.net/Ajey/Jk6XF/
we make use of the property user-select: none;
if you want this to be cross browser, make sure you include all the vendor prefixes
Although using this property should be avoided. But if this makes you happy, go ahead ;)

Ajey
- 7,924
- 12
- 62
- 86