Bootstrap 4导航栏链接不可见,但出现导航栏品牌

时间:2018-11-15 14:39:39

标签: html css bootstrap-4 navbar

我的导航栏具有此代码,但是当我在网站上运行它时,导航栏链接被隐藏了。导航栏的商标名称test确实出现了,但是我不确定为什么其他链接被隐藏了。有人知道解决方案吗?

<!DOCTYPE html>
    <html lang="en">
  	<head>
    	<meta charset="utf-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  	</head>
  	<body>
        <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
	        <div class="container">
		        <a class="navbar-brand" href="/">test</a>
		        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" 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 mr-auto">
				        <li class="nav-item active">
					        <a class="nav-link" href="/">Home<span class="sr-only">(current)</span></a>
				        </li>
				        <li class="nav-item">
					        <a class="nav-link" href="/products">Products</a>
				        </li>
			        </ul>
			        <form class="form-inline mt-2 mt-md-0">
				        <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
				        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
			        </form>
		        </div>
	        </div>
        </nav>		
  
		<!-- jQuery first, then Tether, then Bootstrap JS. -->
		<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
		<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
  	</body>
</html>

1 个答案:

答案 0 :(得分:0)

Bootstrap 4.0 alpha.6中不存在navbar-expand-*类。而是使用navbar-toggleable-*或更高版本,例如最新的4.1.3:

https://www.codeply.com/go/k2jEkNyhg7

Why is the Bootstrap 4 Navbar always collapsed?