Cascading Style Sheets (CSS); Getting Started
By Will Bontrager
2003-10-01
Reader Rating:

The One Exception
The one exception is the anchor tag, often referred to as the "A" link tag, the tag you use when you create a link on a web page. The A tag can have three different styles, one for each of it's states: link, active, and visited. To see how it works, change your mysite.css style sheet file so it has these thirty lines:
BODY, TD, P, LI, BLOCKQUOTE {
font-family: arial,helvetica,sans-serif;
font-size: 14px;
color: #000000;
}
H1 {
font-size: 36px;
font-weight: bold;
text-align: center;
color: red;
background: blue;
}
A:link {
color: yellow;
background: red;
font-weight: bold;
}
A:active {
text-decoration: underline;
}
A:visited {
color: red;
background: yellow;
font-style: italic;
text-decoration: line-through;
}
With the above, your linked text will be bold, colored yellow, and with a red background. When the link is active (while it's being clicked on), it will be underlined. Once the linked page has been visited, the text will be italic and have a line through it, the text color will be red, and the background will be yellow.
Note that the "active" and "visited" behave differently in different browsers. If you specify font changes in the "active" style, the change might or might not display. Changing the font style to italic in the "visited" style causes the font to be italic; however, in some browsers the font weight remains bold as specified in the "link" style and in other browsers the font weight becomes normal.
Copyright 2004 Bontrager Connection, LLC
If you found this article interesting, you may want to read these as well:
» Cascading Style Sheets (CSS); Backgrounds (part 2 of 2)
» Cascading Style Sheets (CSS); Backgrounds (part 1 of 2)
» Cascading Style Sheets (CSS); Learning More
|