The CSS Corner: How To Use CSS3 Pseudo-Classes

Hi all,

I wanted to share with you this great article on CSS3 from Smashing Magazine I ran into.

CSS3 is a wonderful thing, but it’s easy to be bamboozled by the transforms and animations (many of which are vendor-specific) and forget about the nuts-and-bolts selectors that have also been added to the specification. A number of powerful new pseudo-selectors (16 are listed in the latest W3C spec) enable us to select elements based on a range of new criteria.

Some of the new pseudo-classes and selectors CSS3 has are:
  • :nth-child(n)
  • :nth-last-child(n)
  • :nth-of-type(n)
  • :nth-last-of-type(n)
  • :first-of-type
  • :last-of-type
  • :only-of-type
  • :last-child
  • :only-child
  • :empty
  • :target
  • :not
Also, these selectors all work in the latest versions of Chrome, Opera, Safari, Firefox and - would you believe it? - IE9.

So, if this is your cup of tea, go read the article here: How To Use CSS3 Pseudo-Classes - Smashing Magazine


Paulo Tavares