CSS Control page text can not be selected User-select:none;

Source: Internet
Author: User

phenomenon : There may be some places in the HTML do not want users to copy text, or a tag to do a click button, the text will be selected quickly, very ugly, this time you can use the following scheme to prohibit text selection.

cause: The mouse point is fast and the text is selected. Solution Solutions: Different browser settings are not the same, User-select is not a standard, browser support is not complete, you need to adjust the different browsers.
1 Body{2 3 -moz-user-select:None;/*Firefox*/4 5 -webkit-user-select:None;/*WebKit Browser*/6 7 -ms-user-select:None;/*IE10*/8 9 -khtml-user-select:None;/*Early Browser*/Ten  One User-select:None; A  -}

User-select has 2 values (none means that the text cannot be selected, text indicates that you can select it)

Ie6-9 has not found the relevant CSS properties

1 // ie6-9 2 3 document.body.onselectstart=document.body.ondrag=function() {45 Returnfalse; 6 7 }

For a chestnut: When doing the app often use the following ~ ~
1 Html,body {2      -webkit-touch-callout:;  3      -webkit-text-size-adjust:;  4      -webkit-tap-highlight-color:;  5      -webkit-user-select:;  6 }

CSS Control page text can not be selected User-select:none;

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.