...

View Full Version : prevent click drag coloring



BubikolRamios
01-04-2010, 04:46 PM
I have a couple of <a>tags that are ment to be a 'button'. dbl click
or click drag ower then colors text inside blue, almost same goes for "input type = 'button'".

Is there a way to prevent that ?

Excavator
01-04-2010, 06:12 PM
Hello BubikolRamios,
Can you show us some code?

linehand
01-05-2010, 03:07 AM
It sounds like he is talking about text becoming selected (thus highlighted blue), by click dragging or double clicking (both are actions that will select text, generally making it blue).

I don't think there is any straight forward way to stop that from happening with just css/html. There may be ways to stop that by using JS.

That said, in Firefox and Safari you can use CSS to change the colors of selected text (text and background colors). So you could set those colors to be the same as when not selected.


::-moz-selection{
background:#cc0000;
color:#fff;
}

::selection {
background:#cc0000;
color:#fff;
}

The one with -moz in it is for Firefox, the other for Safari.

Personally, I don't think you should even bother about this though. Text is meant to be selectable (even text in buttons and such). I don't think any client visiting your site would ever even notice. Even if they do notice, it makes no difference to them whatsoever and certainly wouldn't strike them as any sort of problem.

BubikolRamios
01-05-2010, 02:38 PM
Thanks for replay.

It does appear ugly to me. My <a> tag is sort of yellow, having "+" text in it, doing image magnification. If user clicks fast enough, all sort of thing gets selected ...
Beides I know at least one person who does not care where she clicks, approximate spot is good enough, clicking save button at least 5-6 times at speed of light is not uncommon :), ...

But as you say, there is nothing I can do.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum