首先,我找到了这个链接:
是否有一种方法使文本在HTML页面上不可选择?
但它似乎对我不起作用。我有很多div包含文本,使自定义表。当用户在多行上使用ctrl键并单击时,有时表内容也会突出显示。当我想在表的溢出部分滚动时,这会导致一个问题。
你可以使用这个CSS:
.unselectable {
user-select: none;
}
使用CSS来解决这个问题:
body {
-webkit-user-select: none; /* Webkit */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE 10 */
/* Currently not supported in Opera but will be soon */
-o-user-select: none;
user-select: none;
}