Example 1 — Style Unvisited Links
Give unvisited anchors a green color.
<style>
a:link {
color: forestgreen;
text-decoration-color: hotpink;
}
</style>
<p><a href="https://example.com/a">Demo link A</a></p>
<p><a href="https://example.com/b">Demo link B</a></p> How It Works
- Pick anchors.
a:linkonly considers link elements. - Require unvisited. The URL must not be in history for
:linkto apply. - Set color. Forest green text with a hotpink underline color.
- After a visit. The same URL then matches
:visitedinstead.

