• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >CSS > css 让文字不被选中之-moz-user-select 属性介绍

css 让文字不被选中之-moz-user-select 属性介绍

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-08-06

本文主要包含-moz-user-select等相关知识,佚名 希望在学习及工作中可以帮助到您
他在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

Usage Examples

This sample code provides a simple "Hello, World!" text which prevents the user from selecting the content:

<span style="-moz-user-select: none;">
Hello, World!
</span>

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

css中的 “-moz-user-select”和“-khtml-user-select”属性是什麽意思?以及它们的用法?
<!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,子元素所有的文字都不能选择,包括input输入框中的文字也不能选择。
2、 -moz-all:子元素所有的文字都可以被选择,但是input输入框中的文字不可以被选择。
3、 -moz-none:子元素所有的文字都不能选择,但是input输入框中的文字除外。
IE浏览器下是通过 onselectstart=”javascript:return false;”事件来实现该功能。
</pre>
</body>
</html>
-khtml-是苹果的那个浏览器的 好像现在使用-webkit-user-select: none

您可能想查找下面的文章:

相关文章

  • 2017-08-06CSS如何只改变父元素背景透明度不改变子元素透明度
  • 2017-08-06ul设置列表为一行2条的方法
  • 2017-08-06css overflow溢出隐藏(文字溢出时的自动隐藏处理)
  • 2017-08-06CSS如何修改tr边框属性实例详解
  • 2017-08-06CSS3 仿微信聊天小气泡实例代码
  • 2017-08-06纯CSS3打造属于自己的“小黄人”
  • 2017-08-06css3 伪元素和伪类选择器详解
  • 2017-08-06CSS Usage CSS减肥工具(firefox插件)
  • 2017-08-06CSS水平对齐示例介绍
  • 2017-08-066种非常炫酷的CSS3按钮边框动画特效

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • div水平垂直居中的完美解决方案
    • 兼容浏览器的css网页细线表格设计
    • 30个开发人员有用的CSS代码片段整理值得借鉴
    • 12种CSS BUG解决方法与技巧
    • css3教程之倾斜页面
    • 什么是DIV+CSS?有哪些优势?
    • CSS中背景background-position负值定位深入理解[图文]
    • 纯css实现的下拉菜单只有边框底纹用到图片
    • 使用text-overflow:ellipsis实现溢出文本省略号显示无需js
    • 使用css3制作动感导航条示例

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有