Disable text selection highlighting using CSS

To disable/prevent text selection in your pages you can use CSS user-select property. By using this property you can specifies whether the text of an element can be selected or not.

Below is the example to disable text selection using CSS


<!DOCTYPE html> 
<style type="text/css"> 
<p>Unselectable Text</p> 
<div class="disable-text"> 
<h1>Sample text</h1> 
<p>Selectable Text</p> <h1>Sample Text</h1></div> 

Leave a Reply

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