0

I wrote the code such that if the link is visited it's font-size should decrease, the text should get stroked through and the color should change to mild pink. Only color is changing not anything else.

<!DOCTYPE html>
<html>
<head>
<style>
a:link {
    text-decoration: underline;
    color:black;
}

a:visited {
    text-decoration: line-through;
    font-size:0.2em;
    color:#ff6666;
}

a:hover {
    text-decoration: overline;
    color: #ff1a1a;
    font-size: 1.5em;
    
}

a:active {
    text-decoration: none;
    font-size: 2em;
    color: #800000;
}
</style>
</head>
<body>

<p><b><a href="http://www.facebook.com" target="_blank">This is a link</a></b></p>
<p><b>Note:</b> a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.</p>
<p><b>Note:</b> a:active MUST come after a:hover in the CSS definition in order to be effective.</p>

</body>
</html>

My question is why are other parameters not changing except color when the link is visited?

user31782
  • 7,087
  • 14
  • 68
  • 143
  • Refer [here](http://www.w3schools.com/cssref/sel_visited.asp). Browsers limits the styles that can be set for a:visited links, due to security issues. – Gilsha Feb 04 '16 at 05:08
  • @Gilsha What are those security issues? I don't think just styling a visited link could make security problem. – user31782 Feb 04 '16 at 05:29
  • https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector – Gilsha Feb 04 '16 at 05:32
  • So there are something technical problems related to anonymity. But I'd like to know why only a certain set of styles are still allowed for visited links and how can we actually breach security if other styles were allowed. – user31782 Feb 04 '16 at 05:40

1 Answers1

1

Allowed styles are:

color
background-color
border-color (and border-color for seperate sides)
outline color
column-rule-color
the color parts of fill and stroke

All other styles are inherited from a:link.

Emad Emami
  • 6,089
  • 3
  • 28
  • 38