我在 html/CSS 方面完全是新手,正在尝试为应用程序制作一个简单的网页。有人可以告诉我为什么页面无法显示汉堡包图标吗?我认为它应该在品牌和开始文本之间显示为白色。这是使用下面的脚本实际看起来如何的屏幕截图。 截图:
/* Modify the background color */
.navbar-custom {
background-color: #004d99;
}
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
color: white;
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
color: white;
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:hover .nav-link {
color: white;
}
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<nav class="navbar navbar-custom">
<div>
<a class="navbar-brand" href="/"><strong>The Brand</strong></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation" style="color: white">
<span class="navbar-toggler-icon" style="color: white"></span><small><strong> START</strong></small>
</button>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="25554a555540570b4f5665140b14130b14" rel="noreferrer noopener nofollow">[email protected]</a>/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
感谢任何帮助。
最佳答案
在 span
之间插入图标图像在这里标记<span class="navbar-toggler-icon" style="color: white"></span>
下面我尝试添加我自己的图标,但您可以插入您的图标
示例
.navbar-custom {
background-color: #004d99;
}
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
color: white;
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
color: white;
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom .nav-item:hover .nav-link {
color: white;
}
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<style>
</style>
</head>
<nav class="navbar navbar-custom">
<div>
<a class="navbar-brand" href="/"><strong>The Brand</strong></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation" style="color: white">
<span class="navbar-toggler-icon" style="color: white"><img src="https://placehold.it/25x25/fc5"></span><small><strong> START</strong></small>
</button>
</div>
</nav>
关于html - Bootstrap 汉堡图标不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64462684/