Introduction To CSS
Link Selectors

Hyperlinks are viewed differently depending on what you are doing with them. The four states for an <a> tag are link, visited, active and hover. A link is active when it has been clicked and the hover state applies when the mouse is over the link.

These selectors can be used to specify how links display in each of these states.

a:link { }
a:visited { }
a:hover { }
a:active { }

These selectors are called pseudo-classes.

If you are using the <a> tag with a name attribute so that you can create hyperlinks within a page, you will find that any style rules for the hover state also apply to anywhere you have an anchor tag with a name attribute. You can stop this from happening by altering the a:hover selector as follows,

a:hover[href]: to select only hyperlinks with an href attribute

a:hover[name]: to select only anchors with a name attribute