Advanced Pseudo Classes

The pseudo-classes mentioned in the earlier tutorial are supported by most browsers. There are a number of other pseudo classes as well but either support for these is somewhat limited at present or in some cases it is just a matter of people not knowing about them and how to use them.

:focus - an additional pseudo class that applies to links, input fields, textareas, and selection lists when the field has the focus. Support for using this with fields other than links is limited.

:after and :before pseudo classes can be applied to any element to add content to the page either immediately after or immediately before each element that the style matches. Supported by most recent browsers, just not used a great deal.

:first-child applies the style to the first child within the specified element. Limited support.

:first is used with print media within an @page definition and limits the style to the first page of the document. This pseudo class has higher precedence than :left and :right.

:left and :right are used with print media within an @page definition and limits the style to the left or right pages of the document.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate