标签:tap 不同的 需要 one doc 表示 user start ons
现象:html中可能有些地方不想让用户复制文字,或是用a标签做了个点击按钮,点快的时候文字会被选中,很丑,这个时候可以使用下面的方案禁止文字选中。
1 body{ 2 3 -moz-user-select:none;/*火狐*/ 4 5 -webkit-user-select:none;/*webkit浏览器*/ 6 7 -ms-user-select:none;/*IE10*/ 8 9 -khtml-user-select:none;/*早期浏览器*/ 10 11 user-select:none; 12 13 }
user-select有2个值(none表示不能选中文本,text表示可以选择文本)
IE6-9还没发现相关的CSS属性
1 //IE6-9 2 3 document.body.onselectstart=document.body.ondrag=function(){ 4 5 returnfalse; 6 7 }
1 html,body{ 2 -webkit-touch-callout:none ; 3 -webkit-text-size-adjust:none ; 4 -webkit-tap-highlight-color:transparent ; 5 -webkit-user-select:none ; 6 }
css控制页面文字不能被选中user-select:none;
标签:tap 不同的 需要 one doc 表示 user start ons
原文地址:http://www.cnblogs.com/yuqlblog/p/7954836.html