Html 如何更改引导4中导航栏的引导汉堡图标?
我在为bootstrap 4更改导航栏中的图标时遇到问题。我目前的html格式如下:Html 如何更改引导4中导航栏的引导汉堡图标?,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我在为bootstrap 4更改导航栏中的图标时遇到问题。我目前的html格式如下: <nav class="navbar fixed-top navbar-expand-md navbar-custom"> <a class="navbar-brand" href="#"> <img src="images/logo.svg" width="60px" style="margin-right: 10px;" alt="logo"> <
<nav class="navbar fixed-top navbar-expand-md navbar-custom">
<a class="navbar-brand" href="#">
<img src="images/logo.svg" width="60px" style="margin-right: 10px;" alt="logo">
<span class="logo-text logo-text-small">Brand</span>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Features<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
图像位于
images/hamburger icon.svg
中,我在这里做错了什么?使用开发工具检查元素。您的背景图像是应用于元素的最后一幅吗?如果不是,那么您需要增加特定性。这是最后一个,但图像没有显示吗?在“网络”选项卡中,检查浏览器要准确加载的路径,以及该路径下是否有可用的图像。
Dear please use this css it will work:
.navbar-light .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}
.navbar-inverse .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}
.custom-toggler .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}
Dear please use this css it will work:
.navbar-light .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}
.navbar-inverse .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}
.custom-toggler .navbar-toggler-icon {
background-image: url("images/hamburger-icon.svg");
background-size: 100%;
background-position: center center;
width: 30px;
height: 30px;
display: flex;
}