In the following example, a mouse hover over each link changes the image:
http://www.prism.gatech.edu/~dm257/sprite.html
The trick is the following line of code:
You absolutely can. Of course, the :visited
state will only be visible upon the next load of the page. Browsers are able to determine whether or not a page has been previously accessed via header information.
Here's a jsFiddle that demonstrates the proper declaration order with helpful comments: