Hi Dev,
Hi, i we will discuss how to disable text selection in html. we may as disable all content selection using css. This article will give you simple example of how to disable text selection in html. you will learn how to disable text selection in html.
you need to just add some css, like you can see on below example code. So let’s follow few step to create example of how to disable text selection in html.
Example
<!DOCTYPE html> <html> <head> <title>How To Disable Text Selection In Html - codeplaners.com</title> <style type="text/css"> body{ user-select: none; /* supported by Chrome and Opera */ -webkit-user-select: none; /* Safari */ -khtml-user-select: none; /* Konqueror HTML */ -moz-user-select: none; /* Firefox */ -ms-user-select: none; /* Internet Explorer/Edge */ } </style> </head> <body> <h3>How To Disable Text Selection In Html</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </body> </html>