CSS3 - Pseudo Elements

Pseudo elements in CSS allow you to go a step beyond pseudo classes and reference parts of the web page that are not even represented by an element in the HTML at all.

CSS2 introduced the first four pseudo elements :first-line, :first-letter, :before, and :after. CSS3 redefines these pseudo elements to use a double colon on the front although a single colon is still supported for backwards compatibility.

At one stage there was a proposal to introduce a fifth pseudo element into CSS3 - ::selection which would allow some styling to be applied to whatever content is selected in the browser. This has since been removed from the proposed standard but it appears that most modern browsers have gone ahead and implemented it anyway (although in some instances using the browser specific prefix). It may therefore be possible to use this particular pseudo element in your web pages and have it apply in all modern browsers (which in some ways is a better test of what is actually a standard than the information provided by the W3C).


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow