css 禁止选中文本


在元素上加入以下"user-select: none;"就可实现禁止选中文本了,

以下是兼容各浏览器写法:

-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;

在 IE < 10 和Opera < 15中我们需要在需要禁止选中的元素上面添加属性

unselectable="on"


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM