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-helper class (centre-block)

I am trying to use bootstrap as my main framework to set up my website, however I am having a bit of difficult time to centre my navigation and make it responsive at the same time. I have used .centre-block as it is suggested my bootstrap but did not work, I also did a research over the net also unvain. it will be great if somebody can help.

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header ">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

        </div>


        <div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav">

                <li>
                    <a href="#about">About</a>
                </li>

                <li>
                    <a href="#services">Services</a>
                </li>

<a class="navbar-brand page-scroll" href="#page-top">Brand</a>

                <li>
                    <a  href="#product">product</a>
                </li>
                <li>
                    <a href="#contact">Contact</a>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

1 Answer

Hi Parker. The solution I used when I created a website using Bootstrap was having the container div first and the nav inside it. You could try that and see if I works for your purposes. After all the framework should adapt to your needs and not the other way around, right? Let me know if you decide to give it a shot.

Good luck!