A detailed explanation of the usage of user-select in CSS3

Source: Internet
Author: User

A detailed explanation of the usage of user-select in CSS3

The User-select property is a new property of CSS3 that sets whether the user can select text. Can be used for all elements except replacement elements, the following is a description of the main usage and considerations of user-select, and more information can be found in the CSS3 documentation below.

(1) syntax

user-select:None | Text | All | Element

Default value:text

Scope of application: all elements except the replacement element

(2) Value description

None: text cannot be selected

Text : You can select texts

All : can be selected when all content is as a whole. If you double click or click on a child element in the context, the selected part will be the highest ancestor element that is backtracking upward with that child element.

element: You can select text, but the selection is constrained by the bounds of the element

(3) Browser support situation

To list the degree of support for each browser in the case of a value of None|text|all, when the value is element, most browsers do not support it and are not listed.

(4) Description

1.ie6-9 does not support this property, but it supports the use of the label property onselectstart= "return false;" To achieve the user-select:none effect;Safari and Chrome also support this tag property;

2. Until Opera12.5 still does not support this property, but like ie6-9 , it also supports the use of private label properties unselectable= "on" to achieve User-select: the effect of none; another value ofunselectable is off;

3. In other browsers, except chrome</font> and safari</font>, if the text is set to -ms-user-select:none; The user will not be able to start selecting text in that block of text. However, if the user starts selecting text in other areas of the page, the user can still choose to set the text to -ms-user-select:none; the regional text;

4. The corresponding script feature is userselect

(5) Example

CSS code:

. box{    -webkit-user-select:none;    -moz-user-select:none;    -ms-user-select:none;    User-select:none;}

HTML code:

<p class= "box" onselectstart= "return false;" unselectable= "on" >    this is the test data </p>

A detailed explanation of the usage of user-select in CSS3

The User-select property is a new property of CSS3 that sets whether the user can select text. Can be used for all elements except replacement elements, the following is a description of the main usage and considerations of user-select, and more information can be found in the CSS3 documentation below.

Reference Link: http://www.php.cn/

(1) syntax

user-select:None | Text | All | Element

Default value:text

Scope of application: all elements except the replacement element

(2) Value description

None: text cannot be selected

Text : You can select texts

All : can be selected when all content is as a whole. If you double click or click on a child element in the context, the selected part will be the highest ancestor element that is backtracking upward with that child element.

element: You can select text, but the selection is constrained by the bounds of the element

(3) Browser support situation

To list the degree of support for each browser in the case of a value of None|text|all, when the value is element, most browsers do not support it and are not listed.

(4) Description

1.ie6-9 does not support this property, but it supports the use of the label property onselectstart= "return false;" To achieve the user-select:none effect;Safari and Chrome also support this tag property;

2. Until Opera12.5 still does not support this property, but like ie6-9 , it also supports the use of private label properties unselectable= "on" to achieve User-select: the effect of none; another value ofunselectable is off;

3. In other browsers, except chrome</font> and safari</font>, if the text is set to -ms-user-select:none; The user will not be able to start selecting text in that block of text. However, if the user starts selecting text in other areas of the page, the user can still choose to set the text to -ms-user-select:none; the regional text;

4. The corresponding script feature is userselect

(5) Example

CSS code:

. box{    -webkit-user-select:none;    -moz-user-select:none;    -ms-user-select:none;    User-select:none;}

HTML code:

<p class= "box" onselectstart= "return false;" unselectable= "on" >    this is the test data </p>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.