Demonstration of the use of style and style sheets in HTML 4.0

This demonstrations shows how style sheets in HTML 4.0 can be used in order to have links with the same colour whether they are visited or not.

Here is a normal link, which link will change colour from green to red when visited. Here is an unvisited link Don't click on it!

Here is the same link, but which have the same colour #003399 when visited as when not visited. Here is an unvisited link. Don't click on it!

Here is a normal link, which link will change colour, when visited, according to the defaults set in the web browser. Here is an unvisited link. Don't click on it!

This effect was achieved using cascading style sheets according to HTML 4.0.

It took some experimenting to get this working. In addition to the above standards, I used the HTML validiation facility at URL http://validator.w3.org/ To use this facility, you must ensure that the first line of the HTML file looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Hur har jag åstadkommit detta? Jo, i huvudet på dokumentet har jag lagt in följande HTML-text:

<STYLE type="text/css">
A.allblue:visited { color: #003399 }
A.allblue:link { color: #003399 }
A.changing:visited { color: red }
A.changing:link { color: #009900 }
</STYLE>

Och i HTML-texten står det

<A HREF="url.html" class="allblue">

i alla länkar som alltid skall vara blå, och

<A HREF="url.html" class=changing">

i alla länkar som skall byta färg när de används.