DMXzone Summer Sale: Save up to 51% with code DMXSUMMER26. Ends in

A Guide to CSS3 Pseudo-classes

A walk through the other new CSS3 pseudo-classes

The pseudo-classes are used to target elements without having to add extra classes, attributes or ID; that is why it is called in that way, pseudo-class. Throughout our previous posts, we have covered a few new CSS3 pseudo-classes, including :not, :before and :after, :first-of-type and we also use pseudo-classes in some of our tutorials. And in this post we are going to walk through the other new CSS3 pseudo-classes that have not been covered yet. Let’s take a look.

:nth-child

:nth-child is used to target elements in a particular order of their parent. This pseudo-class is used in conjunction with the following parameters: a number (1, 2, 3, etc), a keyword (odd / even) or an equation (an, an+b, an-b, etc). In the following example, we have three paragraphs inside a <div>.

Comments

Be the first to write a comment

You must me logged in to write a comment.