Please don’t ignore a:visited!

Lars Gerrit Kliesing / LGK
LGK Blog
Published in
1 min readJan 10, 2018

Like most web designers when I wanted to style links with CSS, it kinda looked like this:

a {
color:#8ea6d0;
}
a:hover {
color: #6a8ac1;
}

Quit normal, right?
The bad thing here is: a will override a:visited. And that is really sad. In case you don’t know it: a:visited indicates if the user already has been open this link. And this can be pretty useful. For example if you have a list of links which the user all wants to visit, one after the other. Thanks to a:visited all links he’s already clicked on will be highlighted.

In my case I started using it and on my latest project (it’s my new Portfolio site on lgk.io) I used it like this:

a {
color: #8ea6d0;
}
a:hover {
color: #6a8ac1;
}
a:visited {
color: #d6aaa9;
}
a:visited:hover {
color: #c68886;
}

--

--

Lars Gerrit Kliesing / LGK
LGK Blog

I’m a web developer, so you’ll primarily find posts about coding but also about design (UX/UI) on my Medium site.