Ordering of dynamic pseudo-class blocks in stylesheet

The best order for dynamic link pseudo-class blocks in your stylesheet is (from W3C):

a:link    { color: red }    /* unvisited links */
a:visited { color: blue }   /* visited links   */
a:hover   { color: yellow } /* user hovers     */
a:active  { color: lime }   /* active links    */

The order matters because these dynamic pseudo-classes are not mutually exclusive in CSS2 (some of them were in CSS1), and later rules override earlier ones if they clash. In the example above, if a:link were placed last, all links would be the same colour (red) irrespective of whether they are visited, active or hovered.

Actually this doesn’t only apply to links; in some browsers any element can have :hover, for example.

CSS Golden Rules: Class Names

Name your CSS classes according to what they are for, not what they look like.

That is, use names like codeblock, quotation, document-title, error-message and so on.

I’m currently having to deal with a mess of stylesheets for a client which are full of classnames like bigblack and reddots and bottomrightbox. They are just not helpful. I can see what it looks like by reading the stylesheet, what I want to know is what these classes are expected to be used for! If you have classnames like this, they’ll end up being used indiscriminately, and then you’re in real trouble if you ever want to change anything, because you have no idea what might be affected. But inevitably, at some point, the presentation of the class will get changed, but you can’t change the name because it’s too widely used, so it becomes downright misleading — you have a bigblack class which actually makes the text green or something…

Even worse are names like nobordertable. Here we have an extra dose of useless or wrong information, with the implication that this class is for use with tables (again without telling me what *sort* of table it’s for). Well why not specify that with a selector like table.classname? Then maybe I wouldn’t be finding this class applied to divs, spans, blockquotes….

Addendum 22nd March 2005: The W3C’s explanation is probably clearer.

X Terminal Program Comparison

As a result of eye problems, I started to investigate the visual features offered by different X terminal programs, such as support for TrueType fonts or vertical spacing adjustment. This article features a comparison table and some notes about what I have found so far. It may be of particular interest to the partially sighted or anyone who works long hours in terminal windows. Continue reading X Terminal Program Comparison

Ethical and Ecological Investments for the Child Trust Fund

So, your youngster(s) have just got their cheque for £250 from that nice Mr Brown. Now, what to do with it?

Many people will want to put their child’s trust fund into ethical and environmentally sustainable investments. After all, there’s not a great deal of point in them having a pot of money in 18 years time if the planet has gone to hell by then. You want to invest in their future, right?

Unfortunately, the vast majority of CTF accounts do not assess any criteria of ethical, ecological or social responsibility. And, depressingly, most people probably won’t realise that their CTF is being invested in arms, tobacco, environmental destruction and oppression.

So… where are all the CTF funds to cater for our requirements? Continue reading Ethical and Ecological Investments for the Child Trust Fund