Skip to content

Instantly share code, notes, and snippets.

@nathos
Last active April 3, 2020 23:44
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nathos/4611077 to your computer and use it in GitHub Desktop.
Save nathos/4611077 to your computer and use it in GitHub Desktop.
Sass (SCSS) mixin to disable user-select on an element
@mixin no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@nathos
Copy link
Author

nathos commented Jan 23, 2013

Just putting this here for my own reference, but this already exists in Compass.

@stubar
Copy link

stubar commented Dec 10, 2013

@nathos -webkit-touch-callout: none; doesn't get written by @include user-select(none);

@paulovicmichal
Copy link

Great, it works for me! Thanks.

@mflisikowski
Copy link

-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

-webkit-touch-callout: none;
-ms-text-size-adjust: none;
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment