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;
}
解决方式,为 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;
}
相关文章推荐
- 良心长文:深度学习框架的选择和有关tensorflow编程经验的分享
- CSS hack学习经验分享:IE7浏览器 “div” 标签 “inline-block” 无效的问题
- 深度学习中如何选择一款合适的GPU卡的一些经验和建议分享
- CSS hack学习经验分享:起始之地
- 十八年开发经验分享(一)学习篇
- Dubbo学习过程、使用经验分享及实现原理简单介绍
- 分享记录我的Linux系统入门学习经验
- 分享Swing学习的一些经验
- verilog学习五点经验分享 http://bbs.21ic.com/icview-402231-1-1.html
- 分享一下学习Oracle的经验
- 如何从零开始开发一款嵌入式产品(20年的嵌入式经验分享学习)如何从零开始开发一款嵌入式产品(20年的嵌入式经验分享学习)
- 禁止右键+禁止选择文本JS代码分享(兼容主流浏览器)
- 如何从零开始开发一款嵌入式产品(20年的嵌入式经验分享学习,来自STM32神舟系列开发板设计师的总结)
- 学习分享DBA的经验
- Android 学习经验之分享
- 嵌入式工程师经验分享:嵌入式开发这样来学习!
- 如何从零开始开发一款嵌入式产品(20年的嵌入式经验分享学习)
- [转]经验分享:我的JavaEE学习道路
- 希望和大家多多分享学习经验
- git学习经验分享(一)