css 让文字不被选中之-moz-user-select 属性介绍
网站建设 2023-01-28 20:49www.1681989.com免费网站
他在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 determe whether or not an element may have its content selected.
Media: teractive
Possible uses clude: prohibitg the selection of content attempts to reduce blatant copyg.
Syntax
TARGET_ELEMENT{-moz-user-select: none;}Legal Values
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
h1{
-moz-user-select:-moz-none;
}
</style>
</head>
<body>
<h1>这里在firefox中会显示不同</h1>
<pre>
屏蔽选择的样式定义-moz-user-select属性(只支持ff)。
属性有三个属性值
1、 none用none,子元素所有的文字都不能选择,包括put输入框中的文字也不能选择。
2、 -moz-all子元素所有的文字都可以被选择,put输入框中的文字不可以被选择。
3、 -moz-none子元素所有的文字都不能选择,put输入框中的文字除外。
IE浏览器下是通过 onselectstart=”javascript:return false;”事件来实现该功能。
</pre>
</body>
</html>
-khtml-是苹果的那个浏览器的 好像现在使用-webkit-user-select: none
而在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 determe whether or not an element may have its content selected.
Media: teractive
Possible uses clude: prohibitg the selection of content attempts to reduce blatant copyg.
Syntax
TARGET_ELEMENT{-moz-user-select: none;}Legal Values
Value | Description |
---|---|
herit | Inherit the value from the parent element. |
none | None of the content may be selected. |
text | Only the text with the element may be selected. |
element | A sgle element may be selected (from many). |
elements | Multiple elements may be selected. |
all | The contents must either be selected entirety or none at all. |
toggle | The contents are selected "followg a standard togglg content model" . |
tri-state | unknown |
-moz-all | unknown |
Usage Examples
This sample code provides a simple "Hello, World!" text which prevents the user from selectg the content:
<span style="-moz-user-select: none;">
Hello, World!
</span>
Notes
This property is similar to the property of CSS3.
When the 'none' value was applied to a headg element the content could still be selected.
Aordg 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. As the -moz-user-select was designed to mimic the user-select property, the same applies.
Specification Conformance
Doesn't conform to CSS standards; .
Browser Compatibility
Netscape 6+
Mozilla 0.6+
Firefox 1.0+
See Also
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
h1{
-moz-user-select:-moz-none;
}
</style>
</head>
<body>
<h1>这里在firefox中会显示不同</h1>
<pre>
屏蔽选择的样式定义-moz-user-select属性(只支持ff)。
属性有三个属性值
1、 none用none,子元素所有的文字都不能选择,包括put输入框中的文字也不能选择。
2、 -moz-all子元素所有的文字都可以被选择,put输入框中的文字不可以被选择。
3、 -moz-none子元素所有的文字都不能选择,put输入框中的文字除外。
IE浏览器下是通过 onselectstart=”javascript:return false;”事件来实现该功能。
</pre>
</body>
</html>
-khtml-是苹果的那个浏览器的 好像现在使用-webkit-user-select: none
网站设计
- 静宁会SEO的网站建设公司:全面提升您的网络影
- 提升在线业务的关键:选择最佳的丽水网站建设
- 浙江网站优化发展潜力如何
- 井研专业的网站建设公司:打造您的在线品牌
- 灵山SEO网站建设公司:提升您的在线业务表现
- 蒙城网站建设优化公司:提升您网站表现的理想
- 阳谷企业网站优化:提升线上业务力的关键
- 樟树专业的网站建设公司:打造您在线业务的坚
- 通河百度SEO排名的策略与技巧
- 重庆百度快照排名如何进行精准的客户引流
- 重庆百度快照排名
- 常宁便宜的建站公司:助您轻松打造在线业务
- 巫溪百度网站优化:提升网站曝光率与流量的关
- 湖北整站优化怎么做才能放大客户需求
- 闸北网站建设多少钱?全面解析与预算规划
- 辽宁企业网站优化怎么做电话营销