How to prevent text / content selection from my web page with CSS?
This would be extremely useful for buttons, anchors, tags and other elements that could be selected without the user's interest ...
How to prevent text / content selection from my web page with CSS?
This would be extremely useful for buttons, anchors, tags and other elements that could be selected without the user's interest ...
Using the following CSS rules for elements that can not be selected:
#seletor {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
<head>
<script type="text/javascript">
function RemoveSelection()
{if (window.getSelection) {window.getSelection().removeAllRanges();}}
</script>
</head>
<body onmouseup="RemoveSelection();">
Select some content on this page with the mouse!
</body>