1

Let's say I have the following simple structure on my page:

<div class="logo">
   <img src="logo.jpeg" alt="logo"/>
</div>

When previewing my page in Chrome hitting cmd+A (select all), the image block becomes highlighted. Here's a visual example:

enter image description here

How can I prevent selected element to not highlight like this?

kyun
  • 9,710
  • 9
  • 31
  • 66
Freddy
  • 683
  • 4
  • 35
  • 114
  • 1
    Possible duplicate of [Is there a way to make a DIV unselectable?](https://stackoverflow.com/questions/924916/is-there-a-way-to-make-a-div-unselectable) – Kevin Kloet Oct 06 '17 at 13:13

1 Answers1

1

.user-select-none {
  user-select: none;
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
}
<div class="user-select-none">
  You can not drag this.
</div>
<div class="user-select-on">
  You can drag this.
</div>
kyun
  • 9,710
  • 9
  • 31
  • 66