Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Framework Basics Prototyping with Bootstrap Building a Fixed Navbar

Aaron Dalbec
seal-mask
.a{fill-rule:evenodd;}techdegree
Aaron Dalbec
Front End Web Development Techdegree Student 1,708 Points

bootstrap collaping navbar prolem

For some reason the collapsing navbar is not working.

I am not including the whole HTML just the beginning till the end of nav

<!DOCTYPE html> <html> <head> <title>Ribbit - A Treehouse Project</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> <link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen"> <link href="css/my-styles.css" rel="stylesheet" media="screen"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="../../assets/js/html5shiv.js"></script> <script src="../../assets/js/respond.min.js"></script> <![endif]--> </head> <body>

<!-- Navbar -->

<div class="navbar navbar-inverse navbar-fixed-top"> <div class="container">

    <div class="navbar-header">
    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapsible-navbar aria-expanded="false"">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>

      <a class="navbar-brand text-muted" href="#">Ribbit</a>
    </div>
    <div class="collapse navbar-collapse">

      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">About Ribbit</a></li>
        <li><a href="#">Treehouse</a></li>
      </ul>

    </div>
  </div>
</div>
<!-- End Navbar -->

1 Answer

Tomas Novak
Tomas Novak
6,957 Points

You have mistake with " in here:

data-target="#collapsible-navbar aria-expanded="false""

it should be:

data-target="#collapsible-navbar" aria-expanded="false"

Also the data-target id in missing so it cannot target anything. You should put id="collapsible-navbar".

Check once more the bootstrap documentation http://v4-alpha.getbootstrap.com/components/navbar/#placement because I thing the divs could cause some problems.