Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Created March 23, 2016 09:21
Show Gist options
  • Select an option

  • Save hsleonis/14952c1835af743695fc to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/14952c1835af743695fc to your computer and use it in GitHub Desktop.
Make text unselectable
/*
This is useful in situations where you want to provide an easier/cleaner
copy-paste experience for users (not have them accidentally text-select
useless things, like icons or images). However it's a bit buggy. Firefox enforces
the fact that any text matching that selector cannot be copied. WebKit still
allows the text to be copied if you select elements around it.
Reference: https://css-tricks.com/almanac/properties/u/user-select
*/
.row-of-icons {
-webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */
user-select: none; /* Likely future */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment