【问题标题】:What is a Bootstrap disabled button hover class name?什么是 Bootstrap 禁用按钮悬停类名称?
【发布时间】:2017-12-20 14:41:02
【问题描述】:

在我的网站上,我有一个禁用的按钮。悬停事件后,它会更改错误的颜色。

我想更改此按钮的悬停颜色,但在此问题的引导框架中找不到/不知道什么是类名禁用按钮悬停。

例如:

<button type="submit" class="btn btn-primary" disabled="disabled">My disabled button</button>

【问题讨论】:

  • 这里有什么问题?为什么您的disabled 课程不在课程列表中?
  • 会不会是你的css定义覆盖了默认的disabled-hover-background?
  • @GurtejSingh 是一个属性,而不是类名
  • @JonesVinothJoseph 我的错。我以为他的意思是添加残疾人课程。
  • @Gurtej Singh 我想在悬停事件中更改此禁用按钮的背景颜色。默认引导颜色为蓝色 ...

标签: css twitter-bootstrap dom


【解决方案1】:

这些是您可以使用引导程序制作的两种禁用按钮:

1.禁用UI,但不是按钮本身[使用类disabled](尝试单击sn-p中的按钮)

2.按钮禁用 | Bootstrap 默认在此处应用禁用的效果。 [或同时使用:属性和disabled 类]。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<button type="submit" class="btn btn-primary disabled" onclick="alert('not actaully disabled');">My disabled button</button>
<button type="submit" class="btn btn-primary" disabled onclick="alert('not actaully disabled');">My disabled button</button>

【讨论】:

    【解决方案2】:
    .btn-default[disabled] {
    background: #ccc !important;
    }
    .btn-default[disabled]:hover {
    background: #ccc !important;
    }
    

    我正在使用这个。

    【讨论】:

      【解决方案3】:

      感谢您的帮助。 我已经为这个问题找到了正确的类名。

      随便放

      .btn[disabled]:hover {
          background:#bedd16;
          }
      
      .btn[disabled]:active:focus { 
          color: #000000;
          }
      
      .btn[disabled]:focus { 
          background: #bedd16;
          color: #666666;
          }
      

      用于更改禁用按钮悬停背景... ;)

      【讨论】:

        【解决方案4】:

        Bootstrap 在按钮中有禁用类 你可以这样使用

            <input type="submit"  class="btn btn-default" disabled>
        
        CSS
        
        input[disabled] {
            cursor:not-allowed;
        }
        

        按钮禁用不需要任何 javascript。

        【讨论】:

        • 这实际上不会禁用按钮。它只会添加禁用效果,即:按钮仍然可以点击!
        • 只需在您的代码输入中添加 Small css[disabled] { cursor:not-allowed; }
        • 这不是任何浏览器的默认行为吗?您只需将disabled 属性添加到按钮伴侣:)
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-08-31
        • 2016-01-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-20
        • 1970-01-01
        相关资源
        最近更新 更多