移动端的input都不能输入了,后来发现是
-webkit-user-select :none ;
在移动端开发中,我们有时有针对性的写一些特殊的重置,比如:
<pre>
* {
-webkit - touch - callout: none;
//-webkit-touch-callout:none; 阻止长按图片之后呼出菜单提示复制的行为
//禁用Webkit内核浏览器的文字大小调整功能。
-webkit-text-size-adjust: none;
//避免点击a标签或者注册了click事件的元素时产生高亮
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
//
//禁止用户进行复制.选择.
-webkit-user-select: none;
}
其中,-webkit-user-select :none ;会产生一些问题。
如果网站不需要阻止用户的选择内容的行为就可以使用如下样式:
<pre>
{
-webkit-user-select: text;
-user-select: text;
}
另一种方式:
<pre>
. {
-webkit-user-select: text;
-user-select: text;
}
</pre>
另一种方式:
<pre>
*:not(input.textarea){
-webkit - touch - callout: none;
-webkit - user - select: none;
}
</pre>
user-select , can cause issues in elements with contenteditable="true" ,so better to add that too .
所以,最好把它也加上
最终的代码:
<pre>
[contenteditable = "true"], input, textarea {
-webkit-user- select: auto!important;
-khtml-user-select: auto!important;
-moz-user-select: auto!important;
-ms-user-select: auto!important;
-o-user-select: auto!important;
user-select: auto!important;
}
</pre>
网友评论