O'Reilly logo

Bootstrap for Rails by Syed Fazle Rahman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a navigation bar to the Rails application

We will add the preceding navigation bar to our application. We will place our shop's branding in it and also place some links to our company pages. We will also use a black color navigation bar here and make it stick to the top of the browser window.

Go to App | Views | Layout and open the application.html.erb file. We will place the navigation bar here, since this will be globally visible throughout the website. Place the following markup above the .container element in this file:

 <div class="navbar navbar-inverted navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapibleMenu"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required