My Profile Photo

Rich Werden

A simple site for Rich to write about code and archive some completed projects for future reference...

#TIL: Stop Text From Being Selected

I’ve wondered how pages prevent the copying and pasting of text-content, and was thinking that touchable events would change things somehow. I mean, of course, you could just put all your text on the screen as one big image but, that’s not indexable\searchable. So TIL the CSS argument combo user-select: and touch-callout: which I guess one really should vendor-prefix the heck out of…

.classname { 
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

Go On. Try to select me.

Betcha can’t…