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

What is a CSS Pseudo-Class Selector?

By Jennifer Kyrnin, About.com

The CSS pseudo-class selectors are selectors that are based on some other attribute beyond the element's name, attributes or content. The pseudo-class selectors are:

  • :active matches on active links.
  • :first-child matches on the first child of the element.
  • :focus matches when the element has focus.
  • :hover matches when the element is hovered over by the mouse.
  • :lang matches on the language of the document.
  • :link matches unvisited links.
  • :visited matches visited links.

To remove the underlines from links once they have been visited:

a:visited {
text-decoration : none ;
}

Or to match the first child element of a div, no matter what element it was:

div:first-child {
border : 1px solid blue ;
}
More Web Design / HTML Quick Tips

Explore Web Design / HTML

More from About.com

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

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

All rights reserved.