-1

Can anybody tell How to disable click and selection in li in css

I have tried

.disabled {
    pointer-events:none; 
    opacity:0.6; 
    cursor:not-allowed; 

}

but pointer is coming and able to select text how to avoid

Thanks

user386430
  • 4,837
  • 13
  • 41
  • 45

1 Answers1

1

You need to specify the cursor and user-select properties as none.

 .disabled {
    pointer-events:none; 
    opacity:0.6; 
    cursor:none; 
    -webkit-user-select: none;  /* Chrome all / Safari all */
    -moz-user-select: none;     /* Firefox all */
    -ms-user-select: none;      /* IE 10+ */
    user-select: none;
}

Here is a more in-depth look at user-select: https://css-tricks.com/almanac/properties/u/user-select/

Chris Spittles
  • 15,023
  • 10
  • 61
  • 85