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 Bootstrap Basics Using Bootstrap Components Building a Navbar

Hiram Levy
Hiram Levy
3,382 Points

Why my navbar is not expanding the full of the widht?

Here´s my code, I've been following every instruction of the Boostrap videos: <!DOCTYPE html> <html lang="en"> <head> <title>Full Stack Conf</title> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">

</head>

<body> <div class="container pt-4">

       <!-- navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
  <div class="container">
    <a class="navbar-brand order-1 mr-0" href="https://www.teamtreehouse.com" target="_blank">Presented by Treehouse</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" href="#home">Home <span class="sr-only">(current)</span></a>
        <a class="nav-item nav-link" href="#about">About</a>
        <a class="nav-item nav-link" href="#speakers">Speakers</a>
        <a class="nav-item nav-link" href="#schedule">Schedule</a>
      </div>
    </div>
  </div>
</nav>
<!-- /navbar -->


  <!-- About -->
  <div class="row">
    <div class="col-lg order-lg-2">
        <h3 class="mb-4">About Full Stack Conf</h3>
        <img class="mb-4 img-fluid rounded" src="img/pdx.jpg" alt="Portland">
        <p>The beautiful city of Portland, Oregon will be the host city for Full Stack Conf!</p>
        <p>Explore the future of JavaScript with a lineup of industry professionals. Discover new techniques to advance your career as a web developer.</p>
    </div>
    <div class="col-lg order-lg-1">
        <h3 class="mb-4">Expert Speakers</h3>
        <p>Our expert speaker lineup was just announced, so don't wait too long before grabbing your tickets!</p>
        <p>Want to meet the international JavaScript community and share skills with some of the world's top experts, hackers, and makers? Be the first to know what to expect for the future of JavaScript.</p>
        <p>Full Stack Conf is committed to being inclusive and welcoming for everyone. We look forward to another intensive day of learning and sharing.</p>
    </div>
     <div class="col-lg order-lg-3">
        <h3 class="mb-4">What You'll Learn</h3>
        <ul>
          <li><strong>MongoDB</strong>: NoSQL database</li>
          <li><strong>Express</strong>: Framework for Node</li>
          <li><strong>React</strong>: JavaScript library</li>
          <li><strong>Node.js</strong>: JavaScript environment</li>
          <li><strong>ES2015</strong>: Latest version of JavaScript</li>
          <li><strong>Babel</strong>: JavaScript compiler</li>

</ul> </div> </div><!-- /about -->

  <!-- speakers -->
    <h1 class="display-4 text-center my-5 text-muted">Speakers</h1>
    [Speakers bios goes here]
  <!-- /speakers -->

  <!-- schedule -->
    <h1 class="display-4 text-center my-5 text-muted">Schedule</h1>
    [Conference scehdule goes here]
  <!-- /schedule -->

  <!-- signup form -->
    <hr>
    <div class="row py-4 text-muted">
      <div class="col-md col-xl-5">
        <p><strong>About Treehouse</strong></p>
        <p>Treehouse brings affordable technology education to people everywhere to help them achieve their dreams and change the world.</p>
      </div>
      <div class="col-md col-xl-5 ml-auto">
        <p><strong>Stay up-to-date on Full Stack Conf</strong></p>
        <div class="input-group">
          <input type="text" class="form-control" placeholder="Email">
          <span class="input-group-btn">
            <button class="btn btn-primary" type="button">Sign up</button>
          </span>
        </div>
      </div>
    </div>
    <hr>
  <!-- /signup form -->


</div><!-- /.container -->

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<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>

</body> </html>

2 Answers

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Treehouse Project Reviewer

This is happening due to this line

<div class="container pt-4">

currently being above your <nav> element. In the video, Guil has this placed just below the closing </nav> tag. As you can see at the 01:47 mark of the video.

Moving that tag down and below your navigation element should solve your issue for you 😃

Hiram Levy
Hiram Levy
3,382 Points

Thanks, that solved the problem :D