0

I want to change the color of the anchor tag and blur the image after visiting the link. but the only color is changing and the image looks the same. this is my CSS code

<style>
   .image123{
      padding-left:80px;
   }

   .imgContainer{
      float:left;
      margin: 93px; 
    }

    a:link{
      color:#000;
      text-decoration:none;
    }

    a:visited { 
      color:#fafafc ;
      text-decoration:none;
      opacity:0.2 ;
      filter:alpha(opacity=60);
  }

</style>

here is my HTML part

<a href="breakdown_assistance_ins.php" id="ba" name="ba" >
    <img src="images/breakdwn_assiatance.png" style="height:100px; width:100px;"/>
    <p>Breakdown </p>
</a>

Can anyone tell me the reason why I couldn't blur the image and help me to do the same?

Gaurav joshi
  • 1,743
  • 1
  • 14
  • 28
siri
  • 125
  • 3
  • 14

2 Answers2

0

add display:inline-block; to your a tag

  .image123{
      padding-left:80px;
   }

   .imgContainer{
      float:left;
      margin: 93px; 
    }

    a:link{
      color:#000;
      text-decoration:none;
    }

    a:visited { 
      color:#fafafc ;
      text-decoration:none;
      opacity:0.2 ;
      filter:alpha(opacity=60); 
     }

    a{
       display:inline-block; /* or block */
     }
Sajan
  • 813
  • 9
  • 14
-1

This should do the trick:

<style>
    a:visited img {
        -webkit-filter: blur(4px);
        filter: blur(4px);
    }
</style>

You can also read about filters here: https://developer.mozilla.org/en-US/docs/Web/CSS/filter

EDIT:

Went further in the exploration and as stated by @karthick nagarajan, browsers have stopped supporting anything else than the following properties (Source):

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

The previously given styles would work in any other situation than the :visited selector.

Also, as stated in this previous thread (How can I detect visited and unvisited links on a page?), it is not possible to retrieve the status of those links via Javascript, which make the given example impossible to fulfill given the current security specifications.

Community
  • 1
  • 1