For anchors that act like buttons (for example, Questions, Tags, Users, etc. at the top of the Stack Overflow page) or tabs, is there a CSS standard way to disable the highlighting effect if the user accidentally selects the text?
I realize this could be done with JavaScript, and a little googling yielded the Mozilla-only -moz-user-select
option.
Is there a standard-compliant way to accomplish this with CSS, and if not, what is the "best practice" approach?
I have learned from CSS-Tricks website.
And this also:
If you are using Less and Bootstrap you could write:
Add this to the first div in which you want to disable the selection for text:
If you want to disable text selection on everything except on
<p>
elements, you can do this in CSS (watch out for the-moz-none
which allows override in sub-elements, which is allowed in other browsers withnone
):Try insert this rows to CSS and call the "disHighlight" at class property: