我已经被困在这里很长一段时间了。搜索并尝试了多种方法来删除BS4汉堡包图标的边框颜色(在我的本地,它显示为黄色。在这个片段中,它是蓝色的)
有人可以帮忙解决这个问题吗?感谢帮助!
这是我的代码:
<nav class="navbar sticky-top navbar-expand-lg" style="background-color: #eeeeee">
<button class="navbar-toggler ml-auto hidden-sm-up float-xs-right" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span><i class="fa fa-navicon"></i></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link active" routerLink="/about" routerLinkActive="active">
<span>About</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/projects" routerLinkActive="active">
<span>Projects</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/contact" routerLinkActive="active">
<span>Contact</span>
</a>
</li>
</ul>
</div>
</nav>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
&#13;
答案 0 :(得分:7)
这在Bootstrap 4中对我有用。
.navbar-toggler:focus, .navbar-toggler:active {
outline: none;
box-shadow: none;
}
答案 1 :(得分:4)
单击Bootstrap导航栏图标的汉堡图标时更改或删除边框颜色。您需要进入bootstrap.min.css
文件并转到button:focus
课程。在那里更改或完全删除outline
。像这样:
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focusring-color;
}
答案 2 :(得分:2)
对于Bootstrap来说,他们不使用边框来使用大纲
的导航focus
你可以删除它宽度:
button.navbar-toggler.ml-auto.hidden-sm-up.float-xs-right:focus {
outline: none!important;
}
希望这个帮助:&gt;
button.navbar-toggler.ml-auto.hidden-sm-up.float-xs-right:focus {
outline: none!important;
}
<nav class="navbar sticky-top navbar-expand-lg" style="background-color: #eeeeee">
<button class="navbar-toggler ml-auto hidden-sm-up float-xs-right" type="button" data-toggle="collapse" data-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span><i class="fa fa-navicon"></i></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link active" routerLink="/about" routerLinkActive="active">
<span>About</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/projects" routerLinkActive="active">
<span>Projects</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/contact" routerLinkActive="active">
<span>Contact</span>
</a>
</li>
</ul>
</div>
</nav>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
答案 3 :(得分:2)
.navbar-toggler,
.navbar-toggler:focus,
.navbar-toggler:active,
.navbar-toggler-icon:focus {
outline: none;
border: none;
box-shadow: none;
}
答案 4 :(得分:1)
.navbar-toggler {
border:0px;
}
这对我有用
答案 5 :(得分:0)
这应该可以解决问题。使用“检查元素”选项卡找出解决问题所需的CSS。
.navbar-toggler:focus{
box-shadow: none;
}
答案 6 :(得分:0)
button:focus {
outline: none;
outline: none -webkit-focus-ring-color;
}