0

Is there any equivalent for -moz-user-select / -webkit-user-select for IE6 ?

I would like the text on my page not to be selectable in all major browsers.

What is the best solution for that ?

Misha Moroshko
  • 166,356
  • 226
  • 505
  • 746
  • 4
    Why would you ever want to do this?!? Is this some kind of protection for your content (like the infamous 'disable right click' scripts)? I think it only annoys the users... (especially people with weird habits, like selecting the text that they are reading) – Marc Jun 02 '10 at 06:28
  • 1
    First thing it will annoy your users and if you want to protect the content then don't put it on internet, because if it is really important and people need it there will me many ways for them to get rid of any protection, just a simple google search will fetch them number of ways for that. – Vinay Pandey Jun 02 '10 at 06:36
  • 14
    STOP SUPPORTING IE6 – Jason Jun 02 '10 at 06:37
  • 1
    -1 for IE6 + Annoying browser behavior. – aarona Jun 02 '10 at 06:53
  • 3
    Say you created a CSS styled button. You'd want to disable the text on that button. http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting – user1040259 Jan 27 '12 at 00:40
  • Can be usefull for ui elements, ie ExtJs uses this –  Jul 29 '12 at 21:58
  • check here [**unselectable text in ie**](http://www.tek-tips.com/viewthread.cfm?qid=1184318&page=1) – Kali Charan Rajput Jun 02 '10 at 06:22

2 Answers2

0

Here's the example

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unselectable text</title>
</head>

<body style="height: 100%; padding: 0; margin: 0;">

<style>
  .column {width: 30em; margin: 1em;}
  p {position: relative; z-index: 1; //height: 100%;} /* you can remove //height if declare doctype */ 
  .unselector {display: block; position: absolute; z-index: 2; width: 100%; height: 100%; top: 0; left: 0;}
  .unselector img {display: block; position: absolute; z-index: 3; width: 100%; height: 100%;}
</style>

  <div class="column">
    <p>
    <span class="unselector"><img src="1.gif" alt="" border="0" /></span>
    Activists on&nbsp;ships raided by&nbsp;Israeli commandos cast doubt on&nbsp;Israel's version of&nbsp;events that led&nbsp;to at&nbsp;least nine deaths. Yes, the webpage is currently not available. 
    </p>
  </div>

</body>
</html>

p.s. 1.gif is transparent 1px*1px image

yakunins
  • 636
  • 1
  • 9
  • 18
0

if this is for a small element masking, i will go with have an empty DIV over the text, and giving the DIV an absolute position with z-index higher than the text's. make sure the DIV is coving everything.

vsync
  • 118,978
  • 58
  • 307
  • 400