您现在的位置是:网站首页> 编程资料编程资料
css 让文字不被选中之-moz-user-select 属性介绍_CSS教程_CSS_网页制作_
2023-10-30
208人已围观
简介 让文字不被选中,应该有一个css属性进行控制,结果网上查了下发现了-moz-user-select 属性介绍
而在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 |
Usage Examples
This sample code provides a simple "Hello, World!" text which prevents the user from selecting the content:
Hello, World!
Notes
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.
Specification Conformance
Doesn't conform to CSS standards; A Mozilla CSS Extension.
Browser Compatibility
Netscape 6+
Mozilla 0.6+
Firefox 1.0+
See Also
-moz-user-focus
-moz-user-input
-moz-user-modify
这里在firefox中会显示不同
屏蔽选择的样式定义:-moz-user-select属性(只支持ff)。
属性有三个属性值:
1、 none:用none,子元素所有的文字都不能选择,包括input输入框中的文字也不能选择。
2、 -moz-all:子元素所有的文字都可以被选择,但是input输入框中的文字不可以被选择。
3、 -moz-none:子元素所有的文字都不能选择,但是input输入框中的文字除外。
IE浏览器下是通过 onselectstart=”javascript:return false;”事件来实现该功能。
-khtml-是苹果的那个浏览器的 好像现在使用-webkit-user-select: none
相关内容
- CSS Usage CSS减肥工具(firefox插件)_CSS教程_CSS_网页制作_
- 绝对定位才是WEB的精髓_CSS教程_CSS_网页制作_
- 暖春大回馈 我叫MT充值有符石倾情回馈送金币_手机游戏_游戏攻略_
- 神之刃召唤师新玩法详细介绍_手机游戏_游戏攻略_
- 我叫MT无大大姐或新之助平民阵容过英雄煽动者攻略_手机游戏_游戏攻略_
- 神之刃如何刷金币_手机游戏_游戏攻略_
- 我叫MT英雄巡视者贾格马通关视频攻略推荐_手机游戏_游戏攻略_
- 神之刃紫色战宠快速获得方法_手机游戏_游戏攻略_
- 我叫MT新版本符文合成攻略全面解析_手机游戏_游戏攻略_
- 神之刃那些不值得培养的战宠推荐_手机游戏_游戏攻略_
