User-select

Control the selection of text.

Syntax
      user-select: none | -moz-none |  element | text | all ;

none - Block the selection of text from starting on the element and any sub-elements.
-moz-none - Block the selection of text from starting on the element and any sub-elements. (Firefox only)
element - Enable selection to start within the element, but be contained by the bounds of that element.
all - In an HTML editor, if a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected. (Firefox only)
text - Enable selection to start within the element and extend past the element's bounds. (default)

Starting with Firefox 21 none behaves like -moz-none, so selection can be re-enabled on sub-elements using -moz-user-select: text

Examples:
h1 { -moz-user-select: none; }
.emw3class { -webkit-user-select: none; }

#emw3id { -ms-user-select: none; }

Try it:

Blocking the users from selecting text can be useful for text menus and buttons that are interface elements rather than actual content. However it will not prevent the use of Ctrl+A to select all.

Browser Support: Not currently part of any W3C CSS specification, use the vendor prefixed versions: -moz-user-select, -webkit-user-select and -ms-user-select

“Intellect is invisible to the man who has none” ~ Arthur Schopenhauer

Related:

display - How to display an HTML element.


Copyright © 2013-2022 Emw3.com
Some rights reserved