Disable text selection using CSS

Spread the love

Today in this post i am gonna share a valuable CSS Code snippet to disable text selection and the good news is “NO JavaScript Required”.You can disable text selection simply of entire Page or Specific Div/Container.If you have a content based site/blog and you are afraid of people who can stole your content then you can include these CSS Lines to your site page so visitors can’t utilize copy content from your site easily.Although with these you can’t protect your site content completely because it only disable selection but something is always better then nothing 🙂 because stealer can use add-on,firebug,Inspect Element and so forth.

Disable Text Selection using CSS,Prevent Content From Stealing,CSS Text Selection,Disable Text Selection,How to Protect Website Content

Disable text selection using CSS

Below code will disable text selection for whole page.

Disable text selection in specific container using CSS

If you don’t want to disable text selection for entire page then you can apply this code on any specific div and any tag. just create a class name disable-selection.

Now you have two div, one is select-able other is non select-able

Select-able text here…


non Select-able text here…

You can add disable-selection class on any container where you want to disable text-selection for visitor.

Leave a Reply

Your email address will not be published. Required fields are marked *