2个解决方案,
- 简单:从 li 中删除 a href。优点:快速,无需维护。缺点:如果您需要下拉菜单,则不能这样做,可能会破坏设计。
- 首选:添加缺少的 css 类以支持 li 中的 btn。
.navbar .nav > li > a.btn {
display: inline-block; padding: 4px 10px 4px; margin: 5px 5px 6px; line-height: 18px;
}
.navbar .nav > li > a.btn-primary,
.navbar .nav > li > a.btn-primary:hover {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
color: #ffffff;
}
.navbar .nav > li > a.btn-primary:active {
color: rgba(255, 255, 255, 0.75);
}
.navbar .nav > li > a..btn-primary {
background-color: #0074cc;
background-image: -moz-linear-gradient(top, #0088cc, #0055cc);
background-image: -ms-linear-gradient(top, #0088cc, #0055cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0055cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0055cc);
background-image: -o-linear-gradient(top, #0088cc, #0055cc);
background-image: linear-gradient(top, #0088cc, #0055cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0055cc', GradientType=0);
border-color: #0055cc #0055cc #003580;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
}
.navbar .nav > li > a.btn-primary:hover,
.navbar .nav > li > a.btn-primary:active,
.navbar .nav > li > a.btn-primary.disabled,
.navbar .nav > li > a.btn-primary[disabled] {
background-color: #0055cc;
}
.navbar .nav > li > a.btn-primary:active,
.navbar .nav > li > a.btn-primary.active {
background-color: #004099 \9;
}