时间:2021-05-08
他在ie下也能选中文字,但是选中其他列表,不会选中文字,原来它是在不同div中,属于不同的范围,而同事是放在同一个table中,当然会选中。
而在firefox下,文字不会被选中,查看google calender的css,原来还有-moz-user-select这个属性,很好玩!
最后采用一个了js方法,即onselectstart=function{return false;},不让页面进行选择,呵呵,这是很多网站不让复制采用的方法。
Summary
-moz-user-select is a Mozilla property extension to CSS that is used to determine whether or not an element may have its content selected.
Media: interactive
Possible uses include: prohibiting the selection of content in attempts to reduce blatant copying.
Syntax
TARGET_ELEMENT{-moz-user-select: none;}Legal Values
Value Description inherit Inherit the value from the parent element. none None of the content may be selected. text Only the text within the element may be selected. element A single element may be selected (from many). elements Multiple elements may be selected. all The contents must either be selected in entirety or none at all. toggle The contents are selected "following a standard toggling content model" [1]. tri-state unknown -moz-all unknown
This sample code provides a simple "Hello, World!" text which prevents the user from selecting the content:
<span style="-moz-user-select: none;">This property is similar to the user-select property of CSS3.
When the 'none' value was applied to a heading element the content could still be selected.
According to the W3C, the "User agent's default style sheet may override this value. For example, user agents typically do not allow selection of the contents of a BUTTON element. [2] As the -moz-user-select was designed to mimic the user-select property, the same applies.
Doesn't conform to CSS standards; A Mozilla CSS Extension.
Netscape 6+
Mozilla 0.6+
Firefox 1.0+
-moz-user-focus
-moz-user-input
-moz-user-modify
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
以下CSS样式实现了各浏览器的标签禁止选中功能。复制代码代码如下:moz-user-select:-moz-none;-moz-user-select:none
复制代码代码如下:$(el).attr('unselectable','on').css({'-moz-user-select':'-moz-none','-m
要想通过CSS禁用页面内容选中和复制操作,只需在body的样式中,增加如下代码:复制代码代码如下:-moz-user-select:none;-webkit-u
先上效果图:CSS:复制代码代码如下:body{margin:0px;padding:0px;-moz-user-select:none;cursor:defa
一、控制元素的可选值复制代码代码如下:selector{-moz-user-select:none;-webkit-user-select:none;-ms-u