Can't highlight a single word on this webpage using Edge or Firefox

27 Views Asked by At

I'm semi-new to javascript so I hopefully won't get lost on suggested answers. I have a website that I'm trying to figure out why I cannot left click and drag to highlight a single word. The webpage won't let me. Can someone explain how the web developer was able to accomplish this ? Thanks in advance.

Here is the webpage:

www.minimalismmadesimple.com

1

There are 1 best solutions below

1
Amparo Walter On BEST ANSWER

This can be easily accomplished using CSS.

body {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}
<html>
  <body>
    <p>Try and select me</p>
  </body>
</html>

I must mention that this usually is bad for UX! Unless you have an absolutely good reason to use this, you shouldn't be making life harder for other people to use your website.

Also, W3Schools will help you a lot with web: https://www.w3schools.com/howto/howto_css_disable_text_selection.asp