如何更改鼠标悬停链接按钮的颜色? [英] How to change the color of the link button on mouse over ?

查看:106
本文介绍了如何更改鼠标悬停链接按钮的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我试图在鼠标悬停时更改链接按钮的颜色但是它不起作用:



这是我的代码:



Hi all ,

I am trying to change the color of link button when mouse over but it is not working :

This is my code :

<style type="text/css">
       .simple
       {
           color: Red;
       }
       .simple:hover
       {
           color: #1A0006;
       }
   </style>




<table width="100px" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td valign="top" style="width: 40px">
                                <asp:LinkButton CssClass="simple" ID="LinkButton2" ValidationGroup="culture" Text="العربية"

                                    runat="server" ForeColor="Black" Style="text-decoration: none;"></asp:LinkButton>
                            </td>
                            <td valign="bottom" runat="server" id="borders" style="width: 20px;">
                                <img src="images/Capture.PNG" />
                            </td>
                            <td valign="top" style="width: 40px">
                                <asp:LinkButton CssClass="simple" ID="LinkButton1" ValidationGroup="culture" Text="ENGLISH"

                                    runat="server" ForeColor="Black" Style="text-decoration: none"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>





请帮助。



Please help .

推荐答案

删除Forecolor属性



并添加以下内容!important ,所以它只采用这种风格而不是继承的...



Remove Forecolor property

and add following !important, so it will take this style only not the inheritated one...

<style type="text/css">
       .simple
       {
           color: Red !important;
       }
       .simple:hover
       {
           color: #1A0006 !important;
       }
   </style>





enjoy



enjoy


使用javascript通过按钮为鼠标事件分配css。
Use javascript to assign css on mouse events over the button.


参考:



HTTP:// WWW .eggheadcafe.com / community / csharp / 2/10187531 / linkbutton-color-change-on-mouse-over-in-aspnet.aspx [ ^ ]


这篇关于如何更改鼠标悬停链接按钮的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆