Syntax error Set whether the text of the element can be selected or not with CSS

Set whether the text of the element can be selected or not with CSS



Use the CSS user-select property to set whether the text of the element can be selected or not with CSS:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            user-select: none;
         }
      </style>
   </head>
   <body>
      <h2>This is demo heading</h2>
      <div>This is demo text. You won't be able to select it.</div>
   </body>
</html>
Updated on: 2020-06-25T13:16:59+05:30

119 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements