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 trialZoDo .
13,135 PointsFloat-sm-right not working.....
Hi, I have tried the new class presented in the documentation float-sm-right and it does not work, I have tried to use the class shown in the video as well. any ideas? here is my code:
<a class="nav-link" href="#schedule">Schedule</a>
</li>
</ul>
<a class="navbar-brand float-sm-right mr-0" href="https://teamtreehouse.com">Presented by Treehouse</a>
</nav>
<!-- /navbar -->
4 Answers
Amy Funderburg
18,038 PointsAfter reading the Bootstrap documentation, I have found that this is successful for floating nav-brand to the right ... <a class="navbar-brand navbar-toggler-right mr-0 hidden-xs-down" href="http://wwww.teamtreahouse.com">Presented by Team Treehouse</a> ...
Dave McFarland
Treehouse TeacherBootstrap 4 changed how it aligns elements and has replaced floats with flexbox. Here's what you need to know to get the navbar to work as it does in the video:
Aligning the last button to the right side of the page
Bootstrap 4 no longer uses the responsive utilities mentioned in the video. Now all layout uses Flexbox instead of floats. So to align the last link to the right of the page, use Auto Margins by applying the class mr-auto
to the <ul>
tag containing the main nav buttons like this:
<ul class="navbar-nav mr-auto">
Fixed navbar
The Bootstrap class for creating a fixed navbar is no longer nav-fixed-top
. It's just fixed-top
so just add that class to the <nav>
element like this:
<nav class="navbar fixed-top navbar-toggleable-md navbar-inverse bg-primary">
There's more information in the Teacher's Notes for this video.
Chelsea Rucker
Full Stack JavaScript Techdegree Student 14,613 PointsI added the .justify-content-end class to my anchor tag:
<a class="navbar-brand justify-content-end" href="http://www.teamtreehouse.com">Presented by Treehouse</a>
Then moved it to the bottom of my code, under the closing </ul> tag:
<nav class="navbar fixed-top navbar-toggleable-md navbar-inverse bg-primary">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#home">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#speakers">Speakers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#schedule">Schedule</a>
</li>
</ul>
<a class="navbar-brand justify-content-end" href="http://www.teamtreehouse.com">Presented by Treehouse</a>
</div>
</nav>
Mary Hawley
Front End Web Development Techdegree Graduate 34,349 PointsThe class on the link to the presenter's website as listed in the video should be "pull-sm-right" and not "float-sm-right".
<a class="navbar-brand pull-sm-right mr-0" href="https://teamtreehouse.com">Presented by Treehouse</a>
Harrison Llewellyn
5,422 PointsHarrison Llewellyn
5,422 PointsYour code snippet is the wrong one. You need to show the navbar-brand class.