user-select
Quick Summary for user-select
The user-select CSS property controls whether the user can select text. This doesn't have any effect on content loaded as part of a browser's user interface (its chrome), except in textboxes.
Code Usage for user-select
/* Keyword values */ user-select: none; user-select: auto; user-select: text; user-select: contain; user-select: all;  /* Global values */ user-select: inherit; user-select: initial; user-select: revert; user-select: unset;  /* Mozilla-specific values */ -moz-user-select: none; -moz-user-select: text; -moz-user-select: all;  /* WebKit-specific values */ -webkit-user-select: none; -webkit-user-select: text; -webkit-user-select: all; /* Doesn't work in Safari; use only                              "none" or "text", or else it will                              allow typing in the <html> container */  /* Microsoft-specific values */ -ms-user-select: none; -ms-user-select: text; -ms-user-select: element; 
More Details for user-select

user-select

The user-select CSS property controls whether the user can select text. This doesn't have any effect on content loaded as part of a browser's user interface (its chrome), except in textboxes.

/* Keyword values */ user-select: none; user-select: auto; user-select: text; user-select: contain; user-select: all;  /* Global values */ user-select: inherit; user-select: initial; user-select: revert; user-select: unset;  /* Mozilla-specific values */ -moz-user-select: none; -moz-user-select: text; -moz-user-select: all;  /* WebKit-specific values */ -webkit-user-select: none; -webkit-user-select: text; -webkit-user-select: all; /* Doesn't work in Safari; use only                              "none" or "text", or else it will                              allow typing in the <html> container */  /* Microsoft-specific values */ -ms-user-select: none; -ms-user-select: text; -ms-user-select: element; 

Note: user-select is not an inherited property, though the initial auto value makes it behave like it is inherited most of the time. WebKit/Chromium-based browsers do implement the property as inherited, which violates the behavior described in the spec, and this will bring some issues. Until now, Chromium chooses to fix the issues, make the final behavior meets the specifications.

Syntax

none

The text of the element and its sub-elements is not selectable. Note that the Selection object can contain these elements.

auto

The used value of auto is determined as follows:

On the ::before and ::after pseudo elements, the used value is none If the element is an editable element, the used value is contain Otherwise, if the used value of user-select on the parent of this element is all, the used value is all Otherwise, if the used value of user-select on the parent of this element is none, the used value is none Otherwise, the used value is text text

The text can be selected by the user.

all

The content of the element shall be selected atomically: If a selection would contain part of the element, then the selection must contain the entire element including all its descendants. If a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected.

contain

Enables selection to start within the element; however, the selection will be contained by the bounds of that element.

element (IE-specific alias)

Same as contain. Supported only in Internet Explorer.

Note: CSS UI 4 renames user-select: element to contain.

Formal definition

Initial valueauto
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

auto | text | none | contain | all

Examples

HTML

<p>You should be able to select this text.</p> <p class="unselectable">Hey, you can't select this text!</p> <p class="all">Clicking once will select all of this text.</p> 

CSS

.unselectable {   -moz-user-select: none;   -webkit-user-select: none;   -ms-user-select: none;   user-select: none; }  .all {   -moz-user-select: all;   -webkit-user-select: all;   -ms-user-select: all;   user-select: all; } 

Result

Specifications

Specification
CSS Basic User Interface Module Level 4 # content-selection

See also

::selection pseudo-element The JavaScript Selection object Select your preferred language English (US)DeutschEspañolFrançais日本語한국어Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
In this case my anchor this week becomes driving almost 2hrs outside of Atlanta to one of my favorite hard core gyms in the world.. MetroFlex aka The Dungeon. The gym owners turn the heat way up so it becomes a fun sweat box and the gym members just watch from afar and leave me alone. I happily drive myself long distances to find MY ANCHOR. Our anchor allows us to have balance, focus and be as productive as possible. And if you're in the middle of a heavy set and your headphones start to fall off your head, like mine did here.. well.. f*ck the headphones. Let em break and fall. You can always get a new pair, but the iron ain't ever gonna lift itself.
Unknown
Random CSS Property

font-synthesis

The font-synthesis CSS property controls which missing typefaces, bold, italic, or small-caps, may be synthesized by the browser.
font-synthesis css reference