【问题标题】:Css active isse:not workingCss活动问题:不工作
【发布时间】:2010-03-19 18:09:38
【问题描述】:

点击超链接时如何使css活动颜色变为绿色。

我尝试了下面的代码,但它确实有效

请注意,LeftNavBG_2 是绿色图像

a:active.leftMenu { /* Left Menu */
 font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
 font-size: 14px;
 color: #000;
 text-decoration: none;
 width: 144px;
 margin-bottom: 5px;
 display: block;
 max-width: 144px !important;
 vertical-align: bottom;
 padding-top: 5px;
 padding-bottom: 5px;
 background-image: url(../images/LeftNavBG_2.gif);

}

【问题讨论】:

    标签: asp.net css


    【解决方案1】:

    你应该在伪选择器之前指明你的类。试试a.leftMenu:active 而不是a:active.leftMenu

    【讨论】:

      【解决方案2】:

      当用户点击链接时将其变为绿色(鼠标按下):

      a.leftMenu:active, a.leftMenu:focus
      {
         /*your css here*/
      }
      

      当用户访问、点击链接时将其设为绿色:

      a.leftMenu:visited
      {
         /*your css here*/
      }
      

      【讨论】:

        猜你喜欢
        • 2011-12-29
        • 1970-01-01
        • 2023-03-06
        • 1970-01-01
        • 1970-01-01
        • 2016-02-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多