2013-05-17 27 views
10

To pytanie CSS rule to disable text selection highlighting pokazuje, w jaki sposób zapobiec wybraniu tekstu w elemencie. Po uniemożliwieniu wyboru, w jaki sposób można następnie zezwolić na wybór konkretnego elementu podrzędnego? npJak przesłonić "-moz-user-select: none;" na elemencie dziecka?

<div class="no-select"> 
    <p>some text that cannot be selected</p> 
    <p class="select">some text that can be selected</p> 
    <p>some text that cannot be selected</p> 
</div> 

table.no-select{ 
-webkit-touch-callout: none; 
-webkit-user-select: none; 
-khtml-user-select: none; 
-moz-user-select: none; 
-ms-user-select: none; 
user-select: none; 
} 

td.select{-webkit-touch-callout: all !important; 
-webkit-user-select: all !important; 
-khtml-user-select: all !important; 
-moz-user-select: all !important; 
-ms-user-select: all !important; 
user-select: all !important; 
} 

.no-select powyżej reguła działa, ale moja próba .select reguły nie, co jest poprawny sposób to zrobić?

Odpowiedz

13

Wypróbuj -moz-user-select: text zamiast all.

Jako przyszły punkt odniesienia, zawsze gdy chodzi o możliwe wartości reguły css, sprawdź stronę taką jak MDN.

Here to link do MDN dla user-select.

+1

Wielkie dzięki :) –