codewala

code it

Disable Text Selection in Browsers Using CSS

To make the text as non-selectable in browsers (except for IE) paste the following style sheet in the HTML page

body
{
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}

For IE 7 and above use on one the following body tag attribute
unselectable="on"
OR
onselectstart="return false;"

Advertisements

July 17, 2011 Posted by | CSS3, HTML | Leave a comment