将悬停图像(CSS)添加到DataPager中的ASP.NET链接按钮

时间:2022-11-05 13:03:20

I add hover images to .Net LinkButtons using the following method:

我使用以下方法将悬停图像添加到.Net LinkBut​​tons:

.rollover a 
{
  background-image:url(/images/shoppingcart/butpill_continue.gif);
}

.rollover a:hover 
{
  background-image:url(/images/shoppingcart/butpill_continue_over.gif);
}

<div class="rollover">
<asp:LinkButton ID="btnContinue" runat="server"></asp:LinkButton>
</div>

This works fine with regular link buttons.

这适用于常规链接按钮。

I need to add this to my next/previous buttons in a DataPager. I tried setting the ButtonType to "Link" and applying the ButtonCssClass="rollover" but this doesn't work. Is there a way to accomplish this?

我需要将它添加到DataPager中的下一个/上一个按钮。我尝试将ButtonType设置为“Link”并应用ButtonCssClass =“rollover”,但这不起作用。有办法实现这个目标吗?

1 个解决方案

#1


Try changing your css to

尝试将你的CSS更改为

a.rollover { background-image:url(/images/shoppingcart/butpill_continue.gif); }

a.rollover:hover { background-image:url(/images/shoppingcart/butpill_continue_over.gif); }

Or just

.rollover { background-image:url(/images/shoppingcart/butpill_continue.gif); }

.rollover:hover { background-image:url(/images/shoppingcart/butpill_continue_over.gif); }

You'll also have to change your other images to something like this

您还必须将其他图像更改为此类图像

<asp:LinkButton ID="btnContinue" runat="server" CssClass="rollover" />

#1


Try changing your css to

尝试将你的CSS更改为

a.rollover { background-image:url(/images/shoppingcart/butpill_continue.gif); }

a.rollover:hover { background-image:url(/images/shoppingcart/butpill_continue_over.gif); }

Or just

.rollover { background-image:url(/images/shoppingcart/butpill_continue.gif); }

.rollover:hover { background-image:url(/images/shoppingcart/butpill_continue_over.gif); }

You'll also have to change your other images to something like this

您还必须将其他图像更改为此类图像

<asp:LinkButton ID="btnContinue" runat="server" CssClass="rollover" />