how to remove browsers background selection color for images and text?

Total Post:149

Points:1043
 1702  View(s)
Ratings:
Rate this:

Hi Guys

I have display images in my webpage and these image will be change on over image click. Problem is that, when user click (mostly continue) on image for change, image's background (in blue color) are selected in every browser.

This problem will be same for checkbox, dropdown, radio button and any clickable control . This is very irritable. Please help me!

Thanks 

  1. Post:604

    Points:4228
    Re: how to remove browsers background selection color for images and text?

    Hi Royce!

    Use below css, that prievnt to select background on click. use "unselectable" class where you control are difine.

    .unselectable
    {
     -webkit-user-select: none;
     -khtml-user-drag: none;
     -khtml-user-select: none;
     -moz-user-select: none;
     -moz-user-select: -moz-none;
     -ms-user-select: none;
     -o-user-select: none;
     user-select: none;
    }

    way of using

    <div class="unselectable">
        <input type="checkbox" id="chk" style="width: 25px; height: 25px; background-color:#E5E5E5;" />
        <label  for="chk" id="lblChk" style="vertical-align:super;">
            Product</label>
    </div>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!