Arts marketer by day, out-of-hours llama wrangler to the stars by night.

Filter content by

digital media · pictures · videos · weird · interesting · the past · the present · the future · the arts · tips

Even more

Wishlist · Validate · Licensing

CSS pseudo-classes

CSS (cascading style sheets) is the means by which the web looks prettier now than it did in 1998. It's a language that makes it much easier to make webpages look good. The newest version, CSS3, isn't officially released yet, but basically works in the newest browsers. It's behind much of the cool stuff that snazzy webpages do.

Maybe it's just because of the shiny things it does, but CSS is pretty much the only computer language that continues to make me go 'wow'.

Anyway, here is my latest CSS discovery. I had a huge HTML table, generated by Excel, which I needed to quickly format with alternately-coloured rows for readability. I discovered there's a fantastic new pseudo-class called nth-child which will do this with just one line of code:

tr:nth-child(odd) { background-color: #eee; }

Thanks to Ash Mann for then pointing me to this monster article about all the new pseudo-classes in CSS3.