<!DOCTYPE html> | |
<style> | |
a { | |
display: block; | |
width: 100px; | |
height: 100px; | |
} | |
a:visited { | |
background-color: red; | |
} | |
a:link { | |
background-color: green; | |
} | |
</style> | |
<p>You should see a green square below.</p> | |
<a id="link" href=""></a> | |
<script> | |
link.offsetTop; // force recalc | |
link.href = "not-visited.html"; | |
</script> |