Anil Namde
Anil Namde

Reputation: 6618

Pseudo classes in CSS

<a class="success" href="javascript:void(0)"></a>

//CSS for setting background for above link
a.success:hover{
//set background image
}

My intent is to change the class of the link on server side based on success/fail and set icon for the link accordingly. But the above CSS is not working as expected.

Upvotes: 0

Views: 96

Answers (1)

jeroen
jeroen

Reputation: 91792

There is nothing wrong with that css.

However, your link is empty so it will not take up any space meaning that a background image will not be shown.

You will need to put something in the a tag or make it a block level element in order for the element (and the background...) to show.

By the way, I am just assuming that you are not really using the // to comment in your style-sheet as that is not valid. Use /* */ if you want to comment in a style-sheet.

Upvotes: 3

Related Questions