您的位置:首页 > Web前端 > CSS

CSS hack学习经验分享:浏览器选择

2018-04-07 10:48 399 查看
解决问题:双击鼠标选中一段文本,经常被恶心到了。
解决方式,为 html 设置如下样式:html {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Chrome/Safari/Opera */
-khtml-user-select: none; /* Konqueror */
-moz-user-select: none; /* Firefox */
-ms-user-select: none;         /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently not supported by any browser */
}
user-select 属性值默认为“text”
当有需要选中文本的地方可以设置一个类,然后为需要选择的地方添加这个类,如:.canSelect {
-webkit-touch-callout: text;
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: