Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

虛擬類別

翻譯不完整。請協助 翻譯此英文文件

CSS 虛擬類別(pseudo-class)的元素,在特殊狀態下被選取的話,會作為關鍵字被加到選擇器裡面。例如 :hover 會讓用戶的滑鼠停在某個元素的時候,套用指定選擇器的樣式。

Pseudo-classes, together with pseudo-elements, let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on some form elements), or the position of the mouse (like :hover which lets you know if the mouse is over an element or not).

語法

selector:pseudo-class {
  property: value;
} 

基本虛擬類別的目錄

規範

規範 狀態 註解
Fullscreen API Living Standard Defined :fullscreen.
WHATWG HTML Living Standard Living Standard No change from HTML5.
Selectors Level 4 Working Draft 定義 :any-link, :local-link, :scope, :active-drop-target, :valid-drop-target, :invalid-drop-target, :current, :past, :future, :placeholder-shown, :user-error, :blank, :nth-match(), :nth-last-match(), :nth-column(), :nth-last-column(), and :matches().
沒有針對 Selectors Level 3HTML5 虛擬類別的重大更改(though semantic meaning not taken over)
HTML5 Recommendation 定義以下 HTML context 的語意含義: :link, :visited, :active, :enabled, :disabled, :checked, and :indeterminate.
Defined :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, :read-write, and :dir().
CSS Basic User Interface Module Level 3 Candidate Recommendation 定義 :default, :valid, :invalid, :in-range, :out-of-range, :required, :optional, :read-only, and :read-write, but without the associated semantic meaning.
Selectors Level 3 Recommendation Defined :target, :root, :nth-child(), :nth-last-of-child(), :nth-of-type(), :nth-last-of-type(), :last-child, :first-of-type, :last-of-type, :only-child, :only-of-type, :empty, and :not().
Defined the syntax of :enabled, :disabled, :checked, and :indeterminate, but without the associated semantic meaning.
No significant change for pseudo-classes defined in CSS Level 2 (Revision 1).
CSS Level 2 (Revision 1) Recommendation Defined :lang(), :first-child, :hover, and :focus.
No significant change for pseudo-classes defined in CSS Level 1.
CSS Level 1 Recommendation Defined :link, :visited, and :active, but without the associated semantic meaning.

參閱

文件標籤與貢獻者

 此頁面的貢獻者: iigmir
 最近更新: iigmir,