I have the following code but it doesnt seem to work:
<td align="center" style="padding-bottom:52.5px">
<asp:ImageButton CssClass="RightArrow" ID="Image2" runat="server" ImageUrl="/_layouts/Right_GrayArrow.png"/>
</td>
And a CSS class to change image on hover:
.RightArrow:hover
{
background-image: url('/_Layouts/Right_GreenArrow.png') !important;
}
Please advise.
Thanks
An
ImageButtoncontrols renders as a<input type="image" />element with theImageUrlproperty becoming thesrcattribute like:Therefore you are applying a background image to this, which you cannot see as the
srcimage is being overlayed on top of it.You have 2 choices:
1) Change the
ImageButtonto use a background image:If you are going to use this method though, I would recommend using an
<asp:Button />instead. It seems pointless using an<asp:ImageButton />if you’re not even making use of thesrcattribute.2) Use jQuery to change the image on hover:
Worth noting this will only work with javascript enabled, and you must include the jQuery library.