HTML and CSS Reference
In-Depth Information
Even though current browsers let you get away with it, we strongly dis-
courage creating and using the id kinds of style classes. Stick to the
standard style class convention to create correct, robust documents.
8.3.4. Pseudoclasses
In addition to conventional style classes, the CSS2 standard defines
pseudoclasses, which allow you to define the display style for certain
tag states , such as changing the display style when a user selects a hy-
perlink. You create pseudoclasses as you do regular classes, but with
two notable differences: they are attached to the tag name with a colon
rather than a period, and they have predefined names, not arbitrary
ones you may give them. There are seven pseudoclasses, three of which
are explicitly associated with the <a> tag.
8.3.4.1. Hyperlink pseudoclasses
CSS2-compliant browsers distinguish three special states for the hyper-
links created by the <a> tag: not yet visited, currently being visited,
and already visited. The browser may change the appearance of the
tag's contents to indicate its state, such as with underlining or color.
Through pseudoclasses, you may control how these states get displayed
by defining styles for a:link (not visited), a:active (being visited), and
a:visited .
The :link pseudoclass controls the appearance of links that are not se-
lected by the user and have not yet been visited. The :active pseudo-
class defines the appearance of links that are currently selected by the
user and are being processed by the browser. The :visited pseudoclass
defines those links that the user has already visited.
To completely define all three states of the <a> tag, you might write:
a:link {color: blue}
a:active {color: red; font-weight: bold}
a:visited {color: green}
 
Search WWH ::




Custom Search