How to prevent content selection with CSS?

Question:

How to prevent text/content selection of my web page with CSS?

This would be extremely useful for buttons, anchors, tags and other elements that could be selected without the user's interest…

Answer:

Using the following CSS rules for elements that cannot be selected:

#seletor {
   -webkit-touch-callout: none;
   -webkit-user-select: none;
   -khtml-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
}
Scroll to Top