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 :target pseudo selector.
*:target {
background-color: #F5FFE1;
}
This does not work in IE 8 and below and not correctly in Opera.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With