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

1

7

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.

Concerning answered 9/6, 2013 at 2:36 Comment(0)
T
10

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
Twelvemo answered 9/6, 2013 at 7:51 Comment(1)
Many thx, also works for Tizen ( -webkit-user-select: none; )Mroz

© 2022 - 2024 — McMap. All rights reserved.