From 64a40466af1722c0a67c5740015a5499b3a9834a Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Mon, 26 Feb 2018 22:39:58 +0530 Subject: [PATCH] Create disable-selection. --- snippets/disable-selection.md | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 snippets/disable-selection.md 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