Open In App
Related Articles

How to disable text selection highlighting using CSS?

Improve Article
Save Article
Like Article

Making text unselectable is an easy task. All we have to do is to disable the selectivity of the text on our webpage for all the browsers that the webpage is likely to be loaded on. There are some settings/commands used in CSS which are used for enabling/disabling functionalities on specific browsers. Like to disable a certain functionality on our webpage say disabling the selectivity of the text, we will have to disable it for all the available browsers separately else, it will not be applicable on all the browsers.
Let us see what statements do we use for different browsers to disable a selectivity of text.

  • Chrome, Opera: -webkit-user-select
  • Safari: -webkit-touch-callout
  • Mozilla: -moz-user-select
  • Internet Explorer: -ms-user-select


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


Note The text present in the “disable-text” div will not be selected and rest everything is selectable as shown in the output image.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 11 Oct, 2019
Like Article
Save Article
Similar Reads
Complete Tutorials