【问题标题】:How can I change a button's color on hover?如何在悬停时更改按钮的颜色?
【发布时间】:2011-04-23 08:43:11
【问题描述】:

我需要更改悬停按钮的颜色。

这是我的解决方案,但它不起作用。

a.button {
   display: -moz-inline-stack;
   display: inline-block;
   width: 391px;
   height: 62px;
   background: url("img/btncolor.png") no-repeat;
   line-height: 62px;
   vertical-align: text-middle;
   text-align: center;
   color: #ebe6eb;
   font-family: Zenhei;
   font-size: 39px;
   font-weight: normal;
   font-style: normal;
   text-shadow: #222222 1px 1px 0;
}
a.button a:hover{
     background: #383;
}

【问题讨论】:

    标签: css button hover


    【解决方案1】:

    a.button a:hover 表示“悬停在上面的链接是 button 类链接的子链接”。

    转而使用a.button:hover。

    【讨论】:

      【解决方案2】:

      您的选择器似乎错误,请尝试使用:

      a.button:hover{
           background: #383;
      }
      

      你的代码

      a.button a:hover
      

      表示它将使用类按钮在a 内搜索a 元素。

      【讨论】:

        【解决方案3】:
        a.button:hover{
            background: #383;  }
        

        对我有用,但在我的情况下

        #buttonClick:hover {
        background-color:green;  }
        

        【讨论】:

          猜你喜欢
          • 2019-10-19
          • 2017-11-29
          • 2019-03-20
          • 2017-07-21
          • 2012-03-07
          • 2019-09-07
          • 2012-08-16
          • 1970-01-01
          相关资源
          最近更新 更多