1. Home
  2. Computing & Technology
  3. Web Design / HTML

What is a CSS Pseudo-Element Selector?

By , About.com Guide

The CSS pseudo-element selectors are selectors that are arrangements of content within the HTML document that make up a form of undefined element. The pseudo-element selectors are:

  • :after matches after an element, to place generated content.
  • :before matches before an element, to place generated content.
  • :first-letter matches the first letter of an element.
  • :hover matches the first line of text of an element.

To style the first letter of a paragraph with a larger cap:

p:first-letter {
font-size : 2.5em ;
}

Or to add a semi-colon after every list item:

li:after {
content : ";" ;
}
Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. CSS Selectors
  6. CSS Pseudo-Element Selectors - What is a CSS Pseudo-Element Selector>

©2009 About.com, a part of The New York Times Company.

All rights reserved.