【问题标题】:css style remains after click单击后仍保留css样式
【发布时间】:2011-03-04 11:26:58
【问题描述】:

我有一个带有单个样式按钮的简单测试页面。当您将鼠标悬停在按钮上时,我正在使用 a:hover。但是,当您单击按钮时,a:hover 样式仍然存在,直到我单击其他内容为止。我该如何解决这个问题?为什么会这样?

谢谢, 棒。

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">

    <% using (Ajax.BeginForm(new AjaxOptions { }))
       { %>
    <div id="detailActions">
        <a href="#">Delete User</a>
    </div>
    <% } %>
</asp:Content>

我的 CSS:

#detailActions
{
    margin-bottom: 7px;
    padding: 3px 0px 5px 0px;
}
#detailActions
{
    padding: 1px 7px 1px 7px;
    margin: 0px 5px 0px 0px;
    border: solid 1px gray;
    background-color: #ADD8E6;
    cursor: pointer;
    width: auto !important;
    font-weight: bold;
    text-decoration: none;
    color: #003366;
    font-size: 1.2em;
}

#detailActions a:hover, #detailActions a:active, #detailActions a:focus
{
    color: White;
    background-color: #00008B;
}

【问题讨论】:

    标签: jquery css asp.net-mvc ajax


    【解决方案1】:

    a:focus 看起来像是激活了 a:hover 规则。 a:focus 匹配任何被关注的链接。当您单击一个链接时,它会成为焦点。

    去掉a:focus规则应该没问题。

    【讨论】:

      猜你喜欢
      • 2015-09-19
      • 2011-12-05
      • 1970-01-01
      • 1970-01-01
      • 2018-12-03
      • 1970-01-01
      • 2018-05-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多