PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

CSS: Love Hate

Note: This article was originally published at Planet PHP on 8 March 2012.
Planet PHP

The slightly odd title is there for a reason. This post exists for a reason. I'll explain botha

I've always struggled to remember the order in which hyperlink styles should be defined in a stylesheet. Hyperlink styles? Order? I'm talking about these (in alphabetical order):

  • :active
  • :hover
  • :link
  • :visited

They should be specified in the right order or things won't work the way you'd expect them to. Here they are again but this time in the correct order:

  • :link
  • :visited
  • :hover
  • :active

I could go into details why this is the right order but I won't That's not the purpose of this post.

The good news is that there's a mnemonic to remember the order: LoVe HAte. For those not paying attention: mind the casing of the mnemonic!

So that's the title of this post. But why? To keep me from googling each time I forget the order