[转]CSS禁止文字选择

user-select有两个值:

none:用户不能选择文本

text:用户可以选择文本

需要注意的是:user-select并不是一个W3C的CSS标准属性,浏览器支持的不完整,需要对每种浏览器进行调整

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

原文:

http://bg4728.blog.163.com/blog/static/192401052201301553045616/

时间: 2024-08-04 20:01:56

[转]CSS禁止文字选择的相关文章

css禁止用户选择文本(兼容所有浏览器)

css禁止用户选择文本(兼容所有浏览器) 如果让整个页面都禁止选择,可以使用下面的css body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } 如果希望指定元素禁止访问,请看下面的示例代码: <!doctype html> <html

CSS 禁止文字选中

现象:html中可能有些地方不想让用户复制文字,或是用a标签做了个点击按钮,点快的时候文字会被选中,很丑,这个时候可以使用下面的方案禁止文字选中. 原因:鼠标点快了. 解决方案: 不同的浏览器设置的内容不一样,user-select不是一个W3C的标准,浏览器的支持不完成,需要对不同的浏览器进行调整. body{ -moz-user-select: none; /*火狐*/ -webkit-user-select: none; /*webkit浏览器*/ -ms-user-select: non

CSS禁止文字选中

-moz-user-select:none;/*firefox*/ -webkit-user-select:none;/*webkit*/ -ms-user-select:none;/*ie10*/ -khtml-user-select:none;/*早期浏览器*/ user-select:none; IE10以下浏览器无相关css设定 //IE6-IE9 document.body.onselectstart=document.body.ondrag=function(){ return fa

CSS禁止用户选择复制

-webkit-user-select:none ;-moz-user-select:none; P.S. -wekit-gg浏览器 -moz -ff浏览器 WebKit 是一个开源的浏览器引擎,与之相对应的引擎有Gecko(Mozilla Firefox 等使用)和Trident(也称MSHTML,IE 使用). WebKit 内核在手机上的应用也十分广泛,例如 Google 的手机Android. Apple 的 iPhone, Nokia’s Series 60 browser 等所使用的

css禁止文字被选中

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

css和js禁止网页选择文字

user-select有两个值: none:用户不能选择文本 text:用户可以选择文本 需要注意的是:user-select并不是一个W3C的CSS标准属性,浏览器支持的不完整,需要对每种浏览器进行调整 <style> body{ -moz-user-select: none; /*火狐*/ -webkit-user-select: none; /*webkit浏览器*/ -ms-user-select: none; /*IE10*/ -khtml-user-select: none; /*

[转]CSS禁止选择文本功能

有时候,我们为了用户体验,需要禁用选择文本功能.这需要用到一个CSS属性:user-select,user-select的文档点这里 user-select有两个值:none:用户不能选择文本text:用户可以选择文本 需要注意的是:user-select并不是一个W3C的CSS标准属性,浏览器支持的不完整,需要对每种浏览器进行调整 body{ -moz-user-select: none; /*火狐*/ -webkit-user-select: none; /*webkit浏览器*/ -ms-

css实现文字过长显示省略号的方法

<div class="title">当对象内文本溢出时显示省略标记</div> 这是一个例子,其实我们只需要显示如下长度: css实现网页中文字过长截取... title class应该这样写: .title{ width:300px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} 说明: 1.宽度一定要设置,可以根据实际需求调整. 2.white-space:nowrap是禁止文字

CSS立体文字效果最佳实践

上一篇的<纯CSS3文字效果推荐>文章里面推荐了8款纯css实现的文字效果,其中3d文字效果最为流行,限于篇幅仅仅展示了其3D实现原理,没有考虑代码的复用性和可移植性,今天来补充下,顺便领略sass的强大功能,请大家摩摩拳擦擦掌,开工咯! 案例效果还是在codepen,在线研究点这里,下载收藏点这里. 1.单单纯纯的效果一 为了简化操作,我们使用和上一篇文章<纯CSS3文字效果推荐>一样的文档结构,后面的效果大差小不差,也就不再列出. <div contenteditable