htmlcsshyperlinkvisited

CSS rules for :visited won't work (beside color)?


So I wanted to make a checkmark on each link somebody visited. This is basic CSS but somehow :visited will only accept color and no other rules. I've tested it on newest Chrome and FF on Mac and also on MS Edge 14 - same behavior.

Here is also a codepen for testing


<a href="https://gab3.de">gab3.de</a>
<br>
<a href="https://gabrielw.de">gabrielw.de</a>

a:visited {
    color: #ccc;
    text-decoration: line-through;
}

a:visited:before {
  content: "\2713 ";
}

So what's the problem?

demo


Solution

  • These are the properties that can be changed with :visited:

    1. color
    2. List item
    3. background-color
    4. border-color (and its sub-properties)
    5. outline-color

    The color parts of the fill and stroke properties You can only use :visited to change those properties.

    This are due to privacity concerns, as css tricks states on this information: https://css-tricks.com/almanac/selectors/v/visited/