Change div background on visited

Asked

Viewed 67 times

1

I’m trying to alter the bottom of the div, when the person is visiting that link.

I tried to use the visited but it’s not working.

HTML

<div class="e divFloatLeaft">
            <h:link styleClass="menu" value="Página Principal" outcome="index" />
        </div>

CSS

.e:hover {
   background-image:url(./img/fundo-laranja.jpg) !important;
   background-repeat: repeat-x;   
}

.e:visited {
   background-image:url(./img/fundo-laranja.jpg) !important;
   background-repeat: repeat-x; 
}

1 answer

1


You must use .menu:visited, because such a selector is used for links that have been visited, using the hyperlink address. In your example, you are using the element class div.

  • then I would be .div:visited?

  • No, no. You need to use the :visited in the hyperlink element, not in the div.

  • Hmmm and how it would apply the effect in the div if it would be using the link event?

  • You could use Javascript, but with CSS it is not possible.

  • OK thanks, I’ll see if I can find something in jquery to help me with that.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.