Fizzbuzz97 Fizzbuzz97 - 6 months ago 13
HTML Question

Links missing from Bootstrap navbar for desktop screens

I'm attempting to follow the bootstrap 3 examples, but I have a problem with the navbar that I seem unable to resolve. With the following html, the navbar items are present as expected in the toggle menu when the viewport is thin (mobile style), but when expanded to a reasonable desktop width, the navbar links ("example left 1", "example left 2", and "example right 1" in the html below) all disappear completely. What have I left out that makes them disappear?

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Server</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar" class="navbar-toggle collapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button><a href="#" class="navbar-brand">Server</a>
</div>
<div id="navbar" class="navbar-collpase collapse">
<ul class="nav navbar-nav">
<li><a href="#">Example left 1</a></li>
<li><a href="#">Example left 2</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Example right 1</a></li>
</ul>
</div>
</div>
</nav>
<div class="container body-content">
<h1>Welcome</h1>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>

Answer

It appears you misspelled collapse in here: <div id="navbar" class="navbar-collpase collapse">

Comments