我刚刚安装了引导导航,但是在尝试响应式设计时,下拉菜单正在工作,它首先显示为黑色,但随后突然变为白色(仅在下拉菜单完成打开之后),我尝试了所有我找不到的方法要修复它,似乎我只能更改按钮的背景颜色,谢谢您的帮助。
When opening it's black then it becomes white like this
CSS
body {
background-color: #f1f2f6;
}
.logo {
width: 50%;
display: block;
margin-left: auto;
margin-right: auto;
}
#header-color {
background-color: #ffffff;
}
.navbar-nav.navbar-center {
position: absolute;
left: 50%;
transform: translatex(-50%);
}
#jpflag {
width: 20px;
height: 15px;
vertical-align: middle;
}
HTML
<!DOCTYPE html>
<html>
<head>
<title>Pandaberu - パンダベル</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
</head>
<body>
<header>
<!-- Logo -->
<div id="header-color">
<div class="logocontainer">
<img src="./images/logo.png" class="logo img-fluid" alt="Pandaberu logo">
</div>
<!-- Navigation -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- <a class="navbar-brand" href="#">WebSiteName</a> -->
</div>
<div class="collapse navbar-collapse text" id="myNavbar">
<ul class="nav navbar-nav navbar-center">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="#">Japanese</a></li>
<li><a href="#">About me</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#"><img src="./images/jpflag.png" alt="Nihongo" id="jpflag"></a></li>
</ul>
<!-- <ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
<li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul> -->
</div>
</div>
</nav>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
</header>
</body>
</html>