• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. SELECTORS, PSEUDO-ELEMENTS A... > Pseudo-Elements and Pseudo-Classes

Pseudo-Elements and Pseudo-Classes

CSS2 also introduces a number of new pseudo-elements and pseudo-classes. Pseudo-elements are abstractions that enable functions not specified in the document language. For example, there is nothing in HTML that enables a Web author to specifically format the first letter or first line in a paragraph, but the CSS1 pseudo-elements FIRST-LETTER and FIRST-LINE make this possible. Similarly, pseudo-classes classify elements in ways other than their name, attributes or content, which lie outside typical document structure. This section looks briefly at the new CSS2 pseudo-elements and pseudo-classes.

The BEFORE and AFTER pseudo-elements insert a string and/or otherwise modify the display at the beginning and end, respectively, of the selected Web element. They are always used in conjunction with the CONTENT property. The following is a code snippet that demonstrates how BEFORE and AFTER are typically used:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint