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

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: