这是我的第一次尝试使用Bootstrap 4 beta。我现在有一个慈善组织的网站,它在BS3中正常运行。我正在使用固定顶部导航栏和自定义CSS。当网站被缩小显示时(不是全屏),切换图标不会出现。你能帮我吗?我想让它像导航链接一样是白色的,并且鼠标悬浮时更改链接颜色为可读状态。以下是head链接。
JavaScript代码链接在页面底部。
这是我的代码。
这个页面在这里可以访问:http://ahepa215.org/navbar-top-fixed.html。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="css/custombs4.css" rel="stylesheet"> `
JavaScript代码链接在页面底部。
<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>
这是我的代码。
/* Navbar */
.navbar-custom {
background-color: #3193de;
}
/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
text-decoration: none; color: #fff;
}
/* change the link color */
.navbar-custom .navbar-nav .nav-link {
text-decoration: none; color: #fff;
}
/* change the color of active or hovered links */
.navbar-custom .nav-item.active .nav-link,
.navbar-custom {
text-decoration: none; color: #fff;
}
.nav-item .nav-link:hover {
text-decoration: none; color: #ff0000;
}
/* for dropdown only - change the color of dropdown */
.navbar-custom .dropdown-menu {
background-color: #3193de;
}
.navbar-custom .dropdown-item {
text-decoration: none; color: #fff;
}
.navbar-custom .dropdown-item:hover,
.navbar-custom .dropdown-item:focus {
text-decoration: none; color: #ff0000;
background-color:#3193de;
}
.navbar-header .navbar-toggler {
border: 0;
}
.navbar-toggler-icon {
color: #fff;
}
.navbar-toggler-icon:hover {
background: #ff0000;
}
<nav class="navbar navbar-custom navbar-expand-md">
<a class="navbar-brand" href="#">AHEPA 215</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-custom" aria-controls="navbar-custom" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">About</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">AHEPA</a>
<a class="dropdown-item" href="#">Chapter 215 Brothers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="scholarship.html">Scholarships</a>
</li>
<li class="nav-item">
<a class="nav-link" href="photos.html">Photos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="join.html">Join</a>
</li>
<li class="nav-item">
<a class="nav-link" href="calendar.html">Calendar</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://www.facebook.com/portsmouth.ahepa" target="_blank"><i class="fa fa-facebook"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="mailto:ahepa215@gmail.com"><i class="fa fa-envelope"></i></a>
</li>
</ul>
</div>
</nav>