twitter-bootstrap 在 Bootstrap 3.0 中禁用列表组项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19427850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 18:52:57  来源:igfitidea点击:

Disabled a list-group-item in Bootstrap 3.0

twitter-bootstraptwitter-bootstrap-3

提问by Juan Jardim

I've been using the bootstrap 3.0 and I was wondering how can I disable a list-group-item.

我一直在使用引导程序 3.0,我想知道如何禁用列表组项。

What I tried was to put the disabled atribute in the "a" tag but this not had any effect. I also tried to add the disabled class with the same result.

我试图将禁用的属性放在“a”标签中,但这没有任何效果。我还尝试添加具有相同结果的禁用类。

Here some example:

这里有一些例子:

<div class="list-group">
  <a href="#" class="list-group-item">Add New entry</a>
  <a href="#" class="list-group-item disabled">Delete Entry</a>
</div>

Thanks

谢谢

回答by Bass Jobsen

In Bootstrap there are disabled states for froms, navbars links, nav links, dropdownlinks.

在 Bootstrap 中,froms、navbars 链接、nav 链接、dropdownlinks 有禁用状态。

I think the disable state of the navs best fits your situation: http://getbootstrap.com/components/#nav-disabled-links

我认为导航的禁用状态最适合您的情况:http: //getbootstrap.com/components/#nav-disabled-links

Copy this disable state for your list-group:

为您的列表组复制此禁用状态:

Less:

较少的:

.list-group  > a.disabled  {
      color: @nav-disabled-link-color;

      &:hover,
      &:focus {
        color: @nav-disabled-link-hover-color;
        text-decoration: none;
        background-color: transparent;
        cursor: not-allowed;
      }
    }

Css:

css:

.list-group > a.disabled {
  color: #999999;
}
.list-group > a.disabled:hover,
.list-group > a.disabled:focus {
  color: #999999;
  text-decoration: none;
  background-color: transparent;
  cursor: not-allowed;
}

Example: http://bootply.com/88367

示例:http: //bootply.com/88367

回答by CHEMSEDDINE HAROUIT

In my case I remove the hrefattribute, so it will be :

在我的情况下,我删除了该href属性,因此它将是:

<div class="list-group">
    <a href="#" class="list-group-item">Add New entry</a>
    <a class="list-group-item">Disabled entry</a>
</div>