How do you override “-moz-user-select: none;” on a child element?

删除回忆录丶 提交于 2019-12-30 01:59:08

问题


The question CSS rule to disable text selection highlighting shows how to prevent text selection on an element. Once you have prevented selection, how can you then allow selection for a specific child element?

For example,

<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;
}

The .no-select rule above works, but my attempt at a .select rule does not. What is the correct way to do this?


回答1:


Try -moz-user-select: text instead of all.

As a future reference, whenever concerned about the possible values for a CSS rule, check a site like MDN.

Here is the MDN link for user-select.



来源:https://stackoverflow.com/questions/16600479/how-do-you-override-moz-user-select-none-on-a-child-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!