css设置不允许复制文本内容

it2022-05-05  139

之前做一个网上答题的页面时,考虑到要防止考生利用复制粘贴来提高作弊的可能性,就设计了不允许复制。方法也很简单,通过设置CSS 的 user-select就可以达到目的:

-moz-user-select:none; /* Firefox私有属性 */ -webkit-user-select:none; /* WebKit内核私有属性 */ -ms-user-select:none; /* IE私有属性(IE10及以后) */ -khtml-user-select:none; /* KHTML内核私有属性 */ -o-user-select:none; /* Opera私有属性 */ user-select:none; /* CSS3属性 */

user-select的默认值是 text:可以选择文本none:文本不被选择

转载于:https://www.cnblogs.com/mica/p/11162636.html


最新回复(0)