Saturday, May 31, 2008
Learned something new about hyperlink styles
In my Dreamweaver CS3 reading I learned something new about defining hyperlink styles in your CSS. It was stated that the four link styles had to be defined in a certain order for them to work properly, namely a:link, a:visited, a:hover, a:active. I didn't know why and I'm sure I haven't always followed this practice, so I did some research. First, I found a really good tutorial about defining link styles using Dreamweaver's interface here. But this still didn't explain why the special order, and I was beginning to think it was one of those professional things where it's just done that way and if you don't you'll be made fun of. Then I found a fantastic post at meyerweb that explains it perfectly. I can't explain in a nutshell but it's worth reading. What I have done is thought of a mnemonic to remember the order: Let's Visit Hyperlinks Always (LVHA). Of course this isn't necessary if you're using Dreamweaver to define the styles because the order is right there in the drop down, but it seems so much easier to just write that CSS by hand than going through all those clicks.