【问题标题】:Primeng disabled button changes color when hoveredPrimeng 禁用按钮在悬停时更改颜色
【发布时间】:2018-09-01 22:21:12
【问题描述】:

我更改了悬停时的 p 按钮样式。

我的问题是当按钮状态设置为禁用并且我将其悬停时颜色也会发生变化。

<button pButton type="submit" label="Launch @RT" class="ui-button-success color" [disabled]="groupList.length+ejList.length>0 ? false: true"></button>

然后在 CSS 中:

.ui-button-success.ui-state-disabled, .ui-widget:hover:disabled, .ui-button-success.color{
    background-color: white !important;
    color: #00965E;
}
.ui-button.ui-button-success:hover
{
    background-color: #00965E !important;
    color: white;
}

当它被禁用并悬停时,如何取消更改按钮样式。但是当它启用改变颜色时

【问题讨论】:

    标签: html css angular primeng


    【解决方案1】:

    尝试在此处使用:not() 选择器和:hover

    .ui-button-success {
      background-color: white;
      color: #00965E;
    }
    
    .ui-button-success:not([disabled]):hover {
      background-color: #00965E;
      color: white;
    }
    <button type="button" class="ui-button-success color" disabled>foobar</button>
    <button type="button" class="ui-button-success color">foobar</button>

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 2016-05-26
      • 2017-07-21
      • 2012-08-16
      • 2011-04-23
      • 2016-12-11
      • 1970-01-01
      • 2021-11-10
      • 2019-10-19
      相关资源
      最近更新 更多