Disable Text Selection Highlighting Using CSS
Code below is cross-browser and might work well on all of the latest browsers like Chrome, Firefox, Safari and IE10+.
1. Disable Text Selection Highlighting Of Whole Page
*{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
2. Disable Text Selection Highlighting Of Specific Element (e.g.: A Div)
.unselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
<div class="unselectable"> ...</div>
More Information can be found at below link :
https://developer.mozilla.org/en-US/docs/Web/CSS/user-select?redirectlocale=en-US&redirectslug=CSS/user-select
Comments
Post a Comment