在我的页面中,我已经使用这个css(我从stackoverflow自己获得)的整个div无法选择
.unselectable {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
/*
Introduced in IE 10.
See http://ie.microsoft.com/testdrive/HTML5/msUserSelect/
*/
-ms-user-select: none;
user-select: none;
}
Run Code Online (Sandbox Code Playgroud)
现在我在这个不可选择的div里面得到了一个h2标签.我想让h2成为可选择的.有没有办法轻松实现这一点.
我忘记了一些问题.我在我的代码中得到三个h2我需要特定的一个可选择所以我在这个h2中添加了一个类并尝试了这样的东西.unselectable:not(.class-of-h2)(我从下面的答案得到).但它不起作用
Din*_*ani 23
用于你的h2元素
.unselectable h2{
-moz-user-select: text;
-khtml-user-select: text;
-webkit-user-select: text;
-ms-user-select: text;
user-select: text;
}
Run Code Online (Sandbox Code Playgroud)