diff --git a/snippets/disable-selection.md b/snippets/disable-selection.md new file mode 100644 index 000000000..d39f99d53 --- /dev/null +++ b/snippets/disable-selection.md @@ -0,0 +1,50 @@ +### Disable Selection + +Makes the content unselectable. + +#### HTML + +```html +
+

You can't select me!

+

You can select me!!

+
+``` + +#### CSS + +```css +.unselectable { + user-select: none; +} +``` + +#### Demo + + + +
+

You can't select me!

+

You can select me!!

+
+ + + + + +#### Explanation +`user-select: none` defines that the text cannot be selected. +#### Browser support + + + +⚠️ Requires prefixes for full support and is not actually in any specification. + + + +* https://caniuse.com/#search=user-select