How can I add a CSS-class “highlight” to headlines or sections based on anchors like “…this.html#headline1” (e.g. the TOCs on Wikipedia).
This should also work when coming from a different page (href=”http://mysite.com/this.html#headline1″) and NOT only onclick like here: Highlight a # section in a page – jQuery
In newer browsers, you can make use of the CSS3
:targetpseudo selector.This does not work in IE 8 and below and not correctly in Opera.