cssテキストを選択しない-moz-user-selectプロパティの紹介

3049 ワード

彼は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:

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
cssの「-moz-user-select」と「-khtml-user-select」の属性はどういう意味ですか?それらの使い方は?







ここでfirefoxに異なるが表示されます.

 

マスク のスタイル :-moz-user-selectプロパティ(ffのみサポート).

には3つの があります.

1、none:noneでは、サブエレメントのすべての が できず、input ボックスの も めて できません.

2、-moz-all:サブエレメントのすべての を できますが、input ボックスの は できません.

3、-moz-none:サブエレメントのすべての は できませんが、input ボックスの は されます.

IEブラウザの にはonselectstart="javascript:return false;イベントがこの を します.






-khtml-アップルのあのブラウザの今使うようです-webkit-user-select:none