In development, we often encounter a requirement, that is, some page content is read-only, and some can be copied. This is also often encountered in the page. For example, some website text can be copied directly, while some need to activate the service It can be copied. This actually uses the user-select attribute of css. This is actually very simple to implement. Look at the code:
body {
user-select: none; // 文字不能被选中,无法复制
}
After adding the above string of codes, all the content in our body will not be able to be copied. Next, let’s take a closer look at other attributes of user-select.
Part of the article is excerpted from: https://blog.csdn.net/weixin_43825473/article /details/103854771