Here is the problem. I took default navbar example from bootstrap side(https://v4-alpha.getbootstrap.com/components/navbar/). They show full size navbar in result, that can collapse, when screen gets smaller. But when I've inserted the code into my project, it shows this:
https://ibb.co/fjBNhQ
As you can see it is always collapsed. I tried a lot of other examples, but nothing workes. Here is the code:
<!DOCTYPE html>
<html>
<head>
<title>Test area</title>
<link rel="stylesheet" href="media/css/bootstrap.min.css">
</head>
<body>
<div class="header">
<div class="top-header">
<div class="container">
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="#">Navbar</a>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Features</a>
<a class="nav-item nav-link" href="#">Pricing</a>
<a class="nav-item nav-link disabled" href="#">Disabled</a>
</div>
</div>
</nav>
</div>
</div>
</div>
<script src="media/js/jquery.min.js"></script>
<script src="media/js/popper.min.js"></script>
<script src="media/js/bootstrap.min.js"></script>
</body>
</html>
The code you posted will only work on Bootstrap alpha 6, not beta. This is because the navbar-toggleable*
classes have changed to navbar-expand*
as of Bootstrap 4 beta.
Bootstrap 4.0.0: https://www.codeply.com/go/0c0FC1Lrn2
<nav class="navbar navbar-expand-lg navbar-light bg-faded">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Features</a>
<a class="nav-item nav-link" href="#">Pricing</a>
<a class="nav-item nav-link disabled" href="#">Disabled</a>
</div>
</div>
</nav>
Also see: Bootstrap 4 navbar layout works using CDN, breaks using downloaded code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With