Making text unselectable

This question already has an answer here:

  • How to disable text selection highlighting? 37 answers

  • It varies per browser. These CSS properties will target WebKit and Gecko-based browsers, as well as any future browsers that support user-select :

    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    

    In IE you can make text immediately within an element unselectable (ie doesn't apply to text in its children) by using the unselectable="on" attribute.

    Note that if applying from javascript you MUST use el.setAttribute("unselectable","on") . Just trying el.unselectable="on" will not work. (Tested in IE9).

    链接地址: http://www.djcxy.com/p/7116.html

    上一篇: 防止从Shift + Click中进行选择

    下一篇: 使文字不可选