Highlight linked comment with css and :target

:target pseudo class
:target pseudo class

By using the css pseudo class :target it’s possible to style an element with the id that’s given after the # in a url different. This technique is used in the Subversion FAQ where the current question is marked with a red border.

Another good place to use this, is within your blog. By adding the following three lines to your styles.css your readers will be able to know exactly what comment you (or someone else) are linking to.

This code will give you the behaviour show in the image. To see the differences live, this link gives you a highlighted comment and this gives you the normal colouring.

Unfortunely, as about any other interesting technique, this doesn’t work in IE. It is of course possible to get a similar effect in IE, but that involves javascript.