Export (0) Print
Expand All

Pseudo-classes and pseudo-elements

Style rules are usually attached to an element based on its position in the document structure; however, cascading style sheets use the concepts of pseudo-classes and pseudo-elements to permit formatting based on information that lies outside the document tree. Pseudo-elements are used to address subparts of elements (such as :first-letter or :first-line), whereas pseudo-classes classify elements on characteristics other than their name, attributes, or content (such as :first-child, :visited, or :hover). Pseudo-classes are typically dynamic, in the sense that an element can acquire or lose a pseudo-class while a user interacts with the document.

p:first-child:first-line {text-transform: uppercase;}
Ee341471.alert_note(en-us,Expression.30).gifNote:

When combining selector elements, the type selector must always be specified first and the pseudo-element last. The other elements (class, ID, and pseudo-class) can appear in any order.

Community Additions

ADD
Show:
© 2014 Microsoft