user-select
Summary
Controls the visible highlighting of selections of text and elements. It is possible to blind out selection completely or to allow the selection of text only.
Overview table
- Initial value
all
- Applies to
- Visible elements
- Inherited
- Yes
- Media
- visual
- Animatable
- No
Syntax
user-select: all
user-select: element
user-select: none
user-select: text
Values
- none
- None of the descendants of the element can be selected, neither text nor images.
- text
- Only text of the element and its descendants can be selected.
- all
- Default. Everything, text and images, can be selected.
- element
- Only specified elements can be selected. Only supported in Firefox and Internet Explorer.
Examples
Deactivate selection of text for elements with the class no-select.
.no-select {
user-select: none;
}
Usage
Needs vendor prefixes.
Notes
Also works on mobile devices to suppress selection by touch and hold.
Related specifications
- User Interface for CSS3
- W3C Working Draft
See also
Related articles
CSS Attributes
user-select
Related pages
- IE Test Drive: User-SelectIE Test Drive: User-Select
- [1][1]
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]