Unselectable text (link)
This question already has an answer here:
You can use user-select: none;
so that the text of the element and sub-elements(on which CSS
rule is applied) will not be able to be selected.
a {
-webkit-touch-callout : none; /* iOS Safari */
-webkit-user-select : none; /* Chrome/Safari/Opera */
-khtml-user-select : none; /* Konqueror */
-moz-user-select : none; /* Firefox */
-ms-user-select : none; /* Internet Explorer/Edge */
}
a {
color: #000;
text-decoration: none
}
a {
-webkit-touch-callout: none;
/* iOS Safari */
-webkit-user-select: none;
/* Chrome/Safari/Opera */
-khtml-user-select: none;
/* Konqueror */
-moz-user-select: none;
/* Firefox */
-ms-user-select: none;
/* Internet Explorer/Edge */
user-select: none;
/* Non-prefixed version, currently not supported by any browser */
}
<!- I want the link text "JS Fiddle" to not be selectable. If I can't make it unselectable at least make it look like an image (select all the text at once)? -->
<a draggable="false" href="https://jsfiddle.net/">JS Fiddle</a>
<br>
<img draggable="false" src="http://i.imgur.com/qdYd7hK.png">
那么你可以使用
a{
pointer-events: none;
cursor: default;
}
a{
color: #000;
text-decoration: none;
pointer-events: none;
cursor: default;
}
<!- I want the link "JS Fiddle" to be not selectable. If I can't make it unselectable at least make it look like an image (select all the text at once)? -->
<a href="https://jsfiddle.net/">JS Fiddle</a>
<br>
<img draggable="false" src="http://i.imgur.com/qdYd7hK.png">
链接地址: http://www.djcxy.com/p/7130.html
上一篇: 如何阻止用户使用JavaScript突出显示任何文本?
下一篇: 不可选择的文字(链接)