I would like to prevent user-selection to be possible on a Boostrap navbar, such as : 
http://getbootstrap.com/examples/navbar-fixed-top/
How to stop user-selection ?
I tried user-select: none; but it fails if you do CTRL-A.
Note : I don't want to stop user to copy text on the page, but I want to provide better user experience by avoiding selection of navbar elements.
In bootstrap 4.5 and above, you can just use class="user-select-none"
You could do it like this:
.navbar {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;    
}
More Info:
Mozilla MDN user-select
CSS-Tricks user-select
You could also do it by set the ::selection background color to none
div.navbar *::-moz-selection {
    background: none !important;
}
div.navbar *::selection {
    background: none !important;
}
.navbar {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;    
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With