We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS


Note: Check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers.

控制选取能否被选择.  This does not have any affect on actual selection operation. This doesn't have any effect on content loaded as chrome, except in textboxes. A similar property 'user-focus' was proposed in early drafts of a predecessor of css3-ui but was rejected by the working group.

Formal syntax: none | text | all | element
(-prefix-)user-select: none;
(-prefix-)user-select: text;
(-prefix-)user-select: all;
(-prefix-)user-select: element;
元素内的文字及其子元素将不会被选中. Selection can contain these elements. Starting with Firefox 21 none behaves like -moz-none, so selection can be re-enabled on sub-elements using -moz-user-select:text.
The text of the element and sub-elements will appear as if they cannot be selected. Selection can contain these elements. Selection can be re-enabled on sub-elements using -moz-user-select:text. Starting with Firefox 21 none behaves like -moz-none.
火狐和IE中有效. Enables selection to start within the element; however, the selection will be contained by the bounds of that element.
Note: user-select is not currently part of any W3C CSS specification.  As such, there are minor differences between the browser implementations. Be sure to test your application across browsers.


.unselectable {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  <p class="unselectable">The user is not able to select this text in Firefox, Chrome, Safari and IE.</p>


Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1-webkit (Yes)-moz 10-ms - (Yes)-webkit
element 未实现 (Yes) (Yes)   未实现
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? ? ? ? ?

See also


此页面的贡献者: xlaoyu, SamuraiMe, Sheppy, teoli, MrFish
最后编辑者: xlaoyu,