13

テキスト選択の強調表示を無効にする質問CSS ルールは、要素でのテキスト選択を防止する方法を示しています。選択を禁止したら、特定の子要素の選択を許可するにはどうすればよいでしょうか?

例えば、

<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ルールは機能しますが、私のルールでの試行は.select機能しません。これを行う正しい方法は何ですか?

4

1 に答える 1