CSS Script How to Disable Text Selection

By . Category: CSS, Web Tags: , ,

irnanto.com – Previously we have discussed about how to disable text selection using javascript, when there is an easier way which disables Selection Script Text Using CSS. Its function remains the same as the previous tutorial disable text selection or disable the text selection, but the implementation is slightly different. How to disable text this time using CSS code to be able to prevent the text selection.

Feature selection on a web browser can be manipulated so that it can be disabled for specific interests such as preventing acts of plagiarism or plagiarism. As a web developer, we can not directly mengetur web browser on the user, but we can adjust our website that appears on the user’s browser or client that can not selecting content or to disable the selection of content.

disable text selection web

disable text selection web

How to Install Script CSS Disable Text Selection

There are two ways to disable the CSS script installation is the first selection by putting the code in the head tag and the second in the CSS style file. Do the first by typing css code below in parts or in the head tag on your web.

<style type=”text/css”>
    body{
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
</style>

Save the changes that you provide and see the results. The second way you can put it in an external CSS file as style.css, if you already have it, you can add a script like this alone.

body{
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

If you do not already have a style.css file, create the file and enter the script css as above and make the calling script file is shown below and place it in the head tag.

<link rel=”stylesheet” type=”text/css” media=”all” href=”[url or path location of the file style.css]” />

If so, please save the script to disable text selection that you type on your web files. Please try the results of the changes you make. You must secure more on your content in a way to disable right click and disable the shortcut ctrl + c.

Ok, discussion of CSS Script How to Disable Text Selection has been completed, next time in the continued again with other interesting articles.

No comments yet untuk “CSS Script How to Disable Text Selection”

Tinggalkan Komentar