CSS Tip: Please use ALL Link States

There are four link states which can be specified and each one is equally important – especially when you have multiple link styles in your CSS.  If you miss a state, it can (and does) get picked up by a previous link style either in the same style-sheet, or another style-sheet which can cause issues. I run into a lot of these issues daily while editing SharePoint style-sheets. 

It may seem like you save time and or bandwidth by using shortcuts such as:

.blah a:link, .blah a:visited { color white; } and leaving out the hover/active states, but the fact remains if you use all states, all the time and in the correct order you have complete control at the exact point you need it and there will be no overlap either from styles within the same style-sheet, or other style-sheets.

So please, for the love of all that is holy start using all link states and in the correct order as listed below.  If you have trouble remembering them, think “LoVe HAte”. 

a: link
a: visited
a: hover
a: active

 

This entry was posted in SharePoint 2007. Bookmark the permalink.

2 Responses to CSS Tip: Please use ALL Link States

  1. Mike says:

    And don’t forget a: visited :hover! :)

  2. Shane Perran says:

    Mike,

    I don’t think that’s a legitimate state :)

    Shane