Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts

    prevent click drag coloring

    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 ?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello BubikolRamios,
    Can you show us some code?
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Regular Coder
    Join Date
    Nov 2009
    Posts
    110
    Thanks
    7
    Thanked 9 Times in 9 Posts
    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.

    Code:
    ::-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.

  • #4
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •