Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable text selection IN <li> [closed]

I'm having trouble disabling text selection in a <li> element.

http://jsfiddle.net/U3djn/

<ul>
    <li>Text</li>
</ul>

user-select works in <div>, but doesn't work in <li> content.

like image 279
user2465422 Avatar asked Jun 09 '13 02:06

user2465422


1 Answers

a combination of user-select: none and cursor: default works:

jsFiddle

ul li {
    -moz-user-select: -moz-none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
}

tested on:

  • macOS 10.6: latest chome and firefox
  • windows 7: latest chrome and firefox, IE9
  • android 4.2: latest chrome
like image 178
oezi Avatar answered Sep 28 '22 01:09

oezi