HTML and CSS Reference
The a element and its multiple personalities
Have you noticed that links act a little differently when it comes
to style? Links are chameleons of the element world because,
depending on the circumstance, they can change their style at a
moment's notice. Let's take a closer look:
A nd here' s a link you
h ave click ed on be fore.
W e call t hese “vis ited
li nks.” Us ually, vis ited
li nks are displayed
in a diffe rent co lor
t han unvi sited lin ks so
t hat you can tell the
d ifferenc e. In mo st
b rowsers , visited links
a re purpl e by def ault.
Unlike other elements, the style of an <a> element changes depending
on its state . If the link has never been clicked on, it has one style, and
if it has been clicked on, another. And if you hover over a link, it can
have yet another style. Perhaps there's more to styling <a> elements
than meets the eye? You betcha…let's take a look.