Reputation:
I am pretty sure i seen sites that make firefox (and other browsers?) select text only within a div and not span across other divs. How do i do that
Upvotes: 4
Views: 3098
Reputation: 9267
it seems giving overflow: hidden
encloses the text selection in that div only.
Hope it helps
source https://stackoverflow.com/a/5505944/932473
Upvotes: 2
Reputation: 3983
Based on this.
<html>
<head>
<title>No Select!</title>
<script>
window.onload = function() {
document.onselectstart = function() {return false;} // ie
document.onmousedown = function() {return false;} // mozilla
}
</script>
</head>
<body>
Select me!
</body>
</html>
By the way try to avoid this kind of stuff as it's not cool to prevent visitors from their basic rights!! If someone wants to select a text, they'll know how to do it and there's no way to prevent it.
Upvotes: 0