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

You can select me.

+

You can't select me!

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

You can select me.

+

You can't select me!

+
+ + + +#### Explanation + +`user-select: none` specifies that the text cannot be selected. + +#### Browser support + +⚠️ Requires prefixes for full support. + +* https://caniuse.com/#feat=user-select-none