0

I have css as following and would like to have an effect works that after visiting, the bold word would appears to be normal weight. The a:visited for font color works but doesn't work for font-weight. And I tried with p-tag doesn't work, either. I need this tag to work with h-tag though.

a:link h2{
    color: #FF0000;
    text-decoration:none;
    font-weight:bold;
}

 a:visited h2{
     color: #00FF00;
     font-weight:normal;
}

a:hover h2{
    color: #FF00FF;
    text-decoration:underline;
}

a:active h2{
    color: #0000FF;
}

Is there anyone can help with this? Thanks. trying in plunker here now

2 Answers2

1

As mentioned here:

https://stackoverflow.com/a/8331950/3739658

This is a security feature. The functionality of :visited pseudoclass has been restricted in many modern browsers (FF, IE9+, Chrome) to prevent CSS exploit.

There's no workaround for this issue. You can make some links longer, maybe different fonts to make them appear bolder but other than that, the answer is no.

Community
  • 1
  • 1
imbondbaby
  • 6,351
  • 3
  • 21
  • 54
0

As I have checked in MDN(Mozilla Developer Network), Visited selector only accept some of the CSS properties.

Only the following properties can be applied to visited links:

color
background-color
border-color (and its sub-properties)
outline-color
The color parts of the fill and stroke properties

In addition, even for the properties you can set for visited links, you won't be able to change the transparency between unvisited and visited links, as you otherwise would be able to using rgba() or hsla() color values or the transparent keyword.

Additional Information About :Visited Selector

Suresh Ponnukalai
  • 13,820
  • 5
  • 34
  • 54