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;}

Note

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.

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.