#btnLeft{
width:40px;
padding:2px 5px 2px 5px;
background-color: #20a0a0;
border: thin solid #099;
border-radius:7px;
text-align:center;
font-family:"Futura Md BT";
font-size:large;
color:#FFF;
}
This is a css button.
When user accidentally makes double click instead of single one, text inside the button becomes selected, i.e. - changes its background color.
How to prevent this selecting on double click ?
To disable the text selection when the user double clicks on the HTML element, you can use the user-select property and set its value to none in CSS.
You can't disable anything with CSS, that's a functional-issue. CSS is meant for design-issues. You could give the impression of a textbox being disabled, by setting washed-out colors on it. Keep in mind that disabled inputs won't pass their values through when you post data back to the server.
try little jquery
$(element).mousedown(function(){ return false; })
with css try
-webkit-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-ms-user-select: none;
If you use a <button>
or <a>
tag and include an href
attribute then the behaviour should be mitigated. And its more semantic :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With