Youss
Youss

Reputation: 4222

Div turns blue if clicked to much

I have a simple div that if clicked to much turns blue: JsFiddle

In Chrome its worse, the whole div(30x30px + some other surounding elements) turns blue. Is there anything I can do about this (other than using img)?

Upvotes: 2

Views: 3188

Answers (2)

ACarter
ACarter

Reputation: 5697

This CSS will do the trick:

div::selection {
  display:none;
 }​

It sets the selection (highlight) to display:none, so you don't see it.

Upvotes: 2

Stian
Stian

Reputation: 1299

Sorry for asking, but isn't this just you marking it by double-clicking it? The "blue" highlight effect would be the normal behaviour in all browsers...

If you do not want this behavior, you should make sure it is not selectable by applying styles:

-moz-user-select: none;
-webkit-user-select: none;

Updated:

For Internet Explorer, use the unselectable tag on your div:

<div class="right" unselectable="on">&raquo;</div>

Upvotes: 14

Related Questions