asp.net按钮悬停不工作 [英] asp.net button hover not working

查看:111
本文介绍了asp.net按钮悬停不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在code和CSS我检查了几个环节,并遵循相应地,但我仍然得到这个问题。请解释一下。

 < ASP:按钮的ID =Button1的=服务器背景色=#93C323
            字体名称=的Segoe UI光字体大小=X-LARGE前景色=白高度=41px
            风格=保证金左:144px文本=+添加WIDTH =121px/>

.button:悬停
{
 背景:#DBDBDB;
}
 

解决方案

避免使风格的行内,当你想通过悬停,或动态地改变它。这是我刚刚测试,并正在努力的一个例子:

 < ASP:按钮的ID =Button1的=服务器的CssClass =OneButton文本=OK/>

    <风格类型=文本/ CSS>
        .OneButton
        {
            背景颜色:#93C323;
            字体大小:X-大;
            颜色:白色;
            高度:41px;
            宽度:121px;
            保证金左:144px;
        }

        .OneButton:悬停
        {
            背景颜色:#DBDBDB;
        }
    < /风格>
 

和它的真人版: http://jsfiddle.net/gwSWy/

This is the code and css i have checked several links and followed accordingly but i still get the problem. Kindly explain.

<asp:Button ID="Button1" runat="server" BackColor="#93C323" 
            Font-Names="Segoe UI Light" Font-Size="X-Large" ForeColor="White" Height="41px" 
            style="margin-left: 144px" Text="+ Add" Width="121px" />

.button:hover
{
 background:#DBDBDB;
}

解决方案

Avoid to make the style inline when you like to change it by hover, or dynamically. This is an example that I just tested and is working:

<asp:Button ID="Button1" runat="server" CssClass="OneButton" Text="ok" />

    <style type="text/css">
        .OneButton
        {
            background-color:#93C323;
            font-size:x-large;
            color:White;
            height:41px;
            width:121px;
            margin-left:144px;
        }

        .OneButton:hover
        {
            background-color:#DBDBDB;
        }    
    </style>

And a live version of it: http://jsfiddle.net/gwSWy/

这篇关于asp.net按钮悬停不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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