0

我有这行来自 Twitter Bootstrap 的 CSS,

.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"]
{
    background-image:url("http://cdn.mydomain.com/static/img/glyphicons-halflings-white.png");
}

如果 li 上存在禁用的类,我希望它忽略/不应用该 CSS,我将如何使其适用。.dropdown-menu>li.disabled>a这很容易吗?

4

1 回答 1

1

您可以将一般情况下所需的样式应用于所有内容,然后在脚本中向下,您可以用“禁用”类的另一种样式覆盖它,模仿您的默认行为。

像这样的东西:http: //jsfiddle.net/8cQvz/1/

div{
 display:block;
 height:25px;
 width: 25px;
 background-image:url("image.png");
 float:left;
 margin:5px;
}

div.no
{
 background-image:none;
}
于 2013-01-26T03:45:12.143 回答